websocket: ensure handler on_close() is called after open()#2966
websocket: ensure handler on_close() is called after open()#2966ploxiln wants to merge 1 commit intotornadoweb:masterfrom
Conversation
|
Interesting, this isn't how I read #2958. I thought that issue was about I have some misgivings about delaying In any case, there's a lot of subtlety here and I think we need a test that recreates some of the problematic scenarios. |
|
Yeah, I'm not confident about this solution. I left the job and codebase where I observed the problem over a month ago, so I'm not much help with testing and analysis now. I do recall: when For this, just looking at the code, I didn't see an obvious yield point before But, thinking back now, as mentioned just above, we used a plain |
|
A colleague of the reporter of #2958 here. The report was indeed about try:
await self._accept_connection(handler)
except asyncio.CancelledError:and in open_result = handler.open(*handler.open_args, **handler.open_kwargs)
if open_result is not None:
await open_resultEither of them can cause a context switch to the execution of As my colleague mentioned in the ticket, adding |
attempt to fix #2958