[issue26520] asyncio.new_event_loop() hangs

2016-03-10 Thread Erwin Mayer
Erwin Mayer added the comment: Thank you Guido; I am now trying to always close a loop explicitly and see if it fixes the issue (so far so good in the last 24h). I could not locate this requirement in the EventLoop documentation page

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Guido van Rossum
Guido van Rossum added the comment: Closing the loop is not taken care of by GC, so I would start there. AFAIK that's covered by the docs, but if you think the docs could be clearer please do submit a separate issue with a documentation update (you can easily submit a patch for that!). It would

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Erwin Mayer
Erwin Mayer added the comment: I understand that asyncio is not .NET and did my best to implement "by the book" according to the asyncio documentation I read extensively. My await_async function has in fact nothing in common with what I would do in .NET but is hopefully as close as possible to

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Guido van Rossum
Guido van Rossum added the comment: Asyncio is not .NET. Don't assume that what's "by the book" according to .NET applies to asyncio. -- ___ Python tracker

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Erwin Mayer
Erwin Mayer added the comment: I simply need to run a coroutine synchronously (which may or may not have a loop parameter), so I tried to do it by the book. With .NET it is easy to call .Wait() on a Task (but .NET by default uses a threadpool, not a single-threaded event loop). I am

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Guido van Rossum
Guido van Rossum added the comment: Why are you creating a new event loop for this purpose? There are all sorts of things that can go wrong with that. This is not appropriate for a bug report, you should continue to seek help on StackOverflow. -- resolution: -> rejected status: open

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Erwin Mayer
Erwin Mayer added the comment: This cannot be a firewall issue as a loop can be successfully created thousands of time, for hours, before a creation attempt will hang (with no change from the firewall). The rest of the program (other threads) continues to run and there is memory issue. If I

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread STINNER Victor
STINNER Victor added the comment: Do you have a firewall? Maybe the firewall blocks programs listening on sockets? It would be silly, the socket is only listening on 127.0.0.1 (local link) (or ::1 in IPv6, also local link). Extract of the socketpair() function: try:

[issue26520] asyncio.new_event_loop() hangs

2016-03-09 Thread Erwin Mayer
New submission from Erwin Mayer: I am using the following function to force a coroutine to run synchronously: def await_sync(coro: types.CoroutineType, timeout_s: int=None): """ :param coro: a coroutine or lambda loop: coroutine(loop) :param timeout_s: :return: """ loop