[issue21163] asyncio Task Possibly Incorrectly Garbage Collected

2014-04-05 Thread Richard Kiss
New submission from Richard Kiss: Some tasks created via asyncio are vanishing because there is no reference to their resultant futures. This behaviour does not occur in Python 3.3.3 with asyncio-0.4.1. Also, doing a gc.collect() immediately after creating the tasks seems to fix the problem

[issue21163] asyncio Task Possibly Incorrectly Garbage Collected

2014-04-05 Thread Richard Kiss
Changes by Richard Kiss h...@richardkiss.com: -- hgrepos: -231 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21163 ___ ___ Python-bugs-list

[issue21163] asyncio task possibly incorrectly garbage collected

2014-04-05 Thread Richard Kiss
Changes by Richard Kiss h...@richardkiss.com: -- title: asyncio Task Possibly Incorrectly Garbage Collected - asyncio task possibly incorrectly garbage collected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21163

[issue21163] asyncio task possibly incorrectly garbage collected

2014-04-05 Thread Richard Kiss
Richard Kiss added the comment: I agree it's confusing and I apologize for that. Background: This multiplexing pattern is used in pycoinnet, a bitcoin client I'm developing at https://github.com/richardkiss/pycoinnet. The BitcoinPeerProtocol class multiplexes protocol messages into multiple

[issue21163] asyncio task possibly incorrectly garbage collected

2014-04-05 Thread Richard Kiss
Richard Kiss added the comment: I'll investigate further. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21163 ___ ___ Python-bugs-list mailing

[issue21163] asyncio task possibly incorrectly garbage collected

2014-04-05 Thread Richard Kiss
Richard Kiss added the comment: You were right: adding a strong reference to each Task seems to have solved the original problem in pycoinnet. I see that the reference to the global lists of asyncio.tasks is a weakset, so it's necessary to keep a strong reference myself. This does seem

[issue21209] q.put(some_tuple) fails when PYTHONASYNCIODEBUG=1

2014-04-12 Thread Richard Kiss
New submission from Richard Kiss: import asyncio import os def t1(q): yield from asyncio.sleep(0.5) q.put_nowait((0, 1, 2, 3, 4, 5)) def t2(q): v = yield from q.get() print(v) q = asyncio.Queue() asyncio.get_event_loop().run_until_complete(asyncio.wait([t1(q), t2(q)])) When

[issue21209] q.put(some_tuple) fails when PYTHONASYNCIODEBUG=1

2014-04-12 Thread Richard Kiss
Richard Kiss added the comment: For a reason that I don't understand, this patch to asyncio fixes the problem: --- a/asyncio/tasks.py Mon Mar 31 11:31:16 2014 -0700 +++ b/asyncio/tasks.py Sat Apr 12 20:37:02 2014 -0700 @@ -49,7 +49,8 @@ def __next__(self): return next(self.gen

[issue21163] asyncio doesn't warn if a task is destroyed during its execution

2014-06-19 Thread Richard Kiss
Richard Kiss added the comment: The more I use asyncio, the more I am convinced that the correct fix is to keep a strong reference to a pending task (perhaps in a set in the eventloop) until it starts. Without realizing it, I implicitly made this assumption when I began working on my asyncio

[issue21163] asyncio doesn't warn if a task is destroyed during its execution

2014-06-24 Thread Richard Kiss
Richard Kiss added the comment: I reread more carefully, and I am in agreement now that I better understand what's going on. Thanks for your patience. -- nosy: +Richard.Kiss ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21163