Jean-Louis Fuchs added the comment:
Just to let you know I hit this problem in my code, simplified version:
https://gist.github.com/ganwell/ce3718e5119c6e7e9b3e
Of course it is only a problem because I am a ref-counting stickler.
--
nosy: +Jean-Louis Fuchs
New submission from STINNER Victor:
asyncio.Future.set_exception(exc) sets the exception attribute to exc, but
exc.__traceback__ refers to frames and the current frame probably referes to
the future instance.
Tell me if I'm wrong, but it looks like a reference cycle:
fut -- fut.exception --
STINNER Victor added the comment:
asyncio_break_ref_cycle.patch does not fix the issue on Python 3.3 (for Tulip).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20032
___
Guido van Rossum added the comment:
Do you have an example of code that behaves differently with this patch? I
can't find any.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20032
___
Antoine Pitrou added the comment:
+self._loop.call_soon(traceback.clear_frames,
+ self._exception.__traceback__)
This will keep the traceback alive until called by the event loop, even if
self._exception is cleared in the meantime...
--
STINNER Victor added the comment:
Do you have an example of code that behaves differently with this patch? I
can't find any.
I didn't check in the Python standard library, but the reference cycle is
obvious, and I hate such issue. It introduces tricky issues like memory leaks.
Here is an
Guido van Rossum added the comment:
The cycle will be cleaned up (and the message printed) when the
garbage collector runs next. Your demo doesn't do anything else, so it
never allocates memory, so it never runs gc.collect(). But that's only
because it's a toy program.
Maybe it's time to look
Antoine Pitrou added the comment:
Maybe it's time to look into
http://code.google.com/p/tulip/issues/detail?id=42 ? (It proposes to
run gc.collect() occasionally when the loop is idle.)
Is it possible to break the cycle instead? Or is the graph of references
too complex for that?
--
Guido van Rossum added the comment:
The only reasonable place to break the cycle seems to be the frame containing
the set_exception() call -- but that could be app code.
Looking again at what the patch actually does I think it is too big a hammer
anyway -- it would break debugging tools that
STINNER Victor added the comment:
The cycle will be cleaned up (and the message printed) when the
garbage collector runs next.
Oh, ok. Using the following task, the object is correctly deleted.
---
@asyncio.coroutine
def idle():
while 1:
gc.collect()
yield from
Changes by STINNER Victor victor.stin...@gmail.com:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20032
___
11 matches
Mail list logo