Author Sheng Zhong
Recipients Sheng Zhong, Windson Yang, asvetlov, yselivanov
Date 2018-07-24.16:53:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Sorry I'm having trouble extracting a bug-producing portion of the code  but I can describe the different components, what I think the problem was, and how I resolved it.

There is one main coroutine (aka handler) responsible for handling the logic of communicating with a socket (build packet, respond to incoming packet). At the start of this coroutine it launches another coroutine with ensure_future (aka server) that sends to and receives UDP packets from a socket and puts the responses into an `asyncio.queue` for the corresponding transaction. 

When the handler expects a responding packet, it awaits a get from the queue for this transaction. The handler's execution is wrapped in an `async_timeout.timeout`.

The server is a while True loop that gets its packets from an `asyncio.DatagramProtocol` in which its `datagram_received` method feeds an internal server queue. The server awaits packets on its queue and forwards it to a transaction queue when it receives any. There were no timeouts in the server coroutine.

I expected that waiting for a packet through the Protocol would block the server coroutine but not the handler coroutine, but the problem was that the handler timeout never had a chance to be processed. This issue was resolved by putting a timeout in the server coroutine on waiting for a get on its internal queue with `wait_for`.
Date User Action Args
2018-07-24 16:53:55Sheng Zhongsetrecipients: + Sheng Zhong, asvetlov, yselivanov, Windson Yang
2018-07-24 16:53:55Sheng Zhongsetmessageid: <>
2018-07-24 16:53:55Sheng Zhonglinkissue34159 messages
2018-07-24 16:53:55Sheng Zhongcreate