Exception RuntimeError: RuntimeError('cannot join current thread',) in <Finalize object, dead> ignored

2,067 views
Skip to first unread message

Eli Stevens (Gmail)

unread,
Jul 6, 2011, 9:40:16 PM7/6/11
to cython-users
Hello,

I'm seeing the following error (? warning?) message when using the
multiprocessing threading module from within Cython (the actual code
that produces it is somewhat complex, and I haven't yet distilled a
simple test case that reproduces the behavior):

Exception RuntimeError: RuntimeError('cannot join current thread',)
in <Finalize object, dead> ignored

The original error is from the threading module. I hacked in some
traceback stuff to it, and get the following stack when the exception
gets raised:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 525, in __bootstrap
self.__bootstrap_inner()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 552, in __bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 509, in run
del self.__target, self.__args, self.__kwargs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py",
line 200, in __call__
res = self._callback(*self._args, **self._kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py",
line 463, in _terminate_pool
worker_handler.join()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 656, in join
traceback.print_stack()

I see similar output in the doctests in tests/run/with_gil.pyx, but I
can't seem to find the point in Cython where the output comes from.
Does it come from Cython? Is the message something that can be safely
ignored?

Thanks for any pointers,
Eli

Robert Bradshaw

unread,
Jul 7, 2011, 3:21:38 AM7/7/11
to cython...@googlegroups.com

This typically means you're raising/getting an exception from a cdef
function that does not have an except clause (and so is unable to
propagate exceptions). Such exceptions should usually not be ignored.

- Robet

Eli Stevens (Gmail)

unread,
Jul 10, 2011, 2:04:39 PM7/10/11
to cython...@googlegroups.com
All of the functions involved are cpdef, except for sqrtf from math.h.
:/ My reading of the docs is that I can't put except clauses on
those. I'm assuming that the exception stuff gets handled for me in
that case; is that correct?

Eli

Robert Bradshaw

unread,
Jul 19, 2011, 5:53:36 AM7/19/11
to cython...@googlegroups.com
On Sun, Jul 10, 2011 at 11:04 AM, Eli Stevens (Gmail)
<wicke...@gmail.com> wrote:
> All of the functions involved are cpdef, except for sqrtf from math.h.
>  :/  My reading of the docs is that I can't put except clauses on
> those.  I'm assuming that the exception stuff gets handled for me in
> that case; is that correct?

You can (and probably should) put except clauses on cpdef functions.

Reply all
Reply to author
Forward
0 new messages