streadway/amqp — pull request #84 by streadway (2013-11-07 09:48:08+00:00)
Title: Channel.Publish's blocks upon disconnection during high volume publishes

Firstly, let me say I'm not entirely sure of the behaviour I am observing (yet). I will continue to study it and update here.

It seems as though if you try to `Publish` to a Channel before `shutdown` has a chance to run, it will block forever.

The easiest way to observe this is do a high volume of `Publishes` to a channel and shut RabbitMQ down part way through.

[I have amended `simple_producer.go` to send infinite publishes](https://gist.github.com/alexzorin/4a02c4701ff07d74d4bd), which you may use to reproduce.

**To reproduce**:
1. Spin up RabbitMQ
2. `go run simple_infinite_producer.go -reliable=false`
3. Shut down RabbitMQ after a second or two.

You may observe that the application will block when the last message is something like: `2013/10/31 17:36:36 pre-publish test-exchange 1383201396132042002` and nothing proceeds it.

From the little debugging I have done so far, it seems as though this is happening because `send` is being called before the `shutdown` logic has a chance to replace the `send` function for another.