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
<http://bugs.python.org/is
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
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(sel
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
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 s
Richard Kiss added the comment:
I'll investigate further.
--
___
Python tracker
<http://bugs.python.org/issue21163>
___
___
Python-bugs-list mailing list
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 protoc
Changes by Richard Kiss :
--
title: asyncio Task Possibly Incorrectly Garbage Collected -> asyncio task
possibly incorrectly garbage collected
___
Python tracker
<http://bugs.python.org/issu
Changes by Richard Kiss :
--
hgrepos: -231
___
Python tracker
<http://bugs.python.org/issue21163>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
10 matches
Mail list logo