Re: threading and iterator crashing interpreter
- From: "Janto Dreijer" <jantod@xxxxxxxxx>
- Date: 11 Mar 2007 07:35:58 -0700
On Mar 11, 3:27 pm, "Gabriel Genellina" <gagsl-...@xxxxxxxxxxxx>
wrote:
En Sun, 11 Mar 2007 09:47:34 -0300, Janto Dreijer <jan...@xxxxxxxxx>
escribió:
As far as I can tell I'm not running it from restricted mode
explicitly.
This error is rather strange then:
RuntimeError: instance.__dict__ not accessible in restricted mode
"restricted mode" means that the current builtins are not the standard
builtins.
Googling says "Some googling suggests that this error is a hint that a
Python object created in one subinterpreter is being used in a
different subinterpreter."
The reason I'm doing the random.choice() is so I don't have a handle
("session" in this case) that would prevent it from being garbage
collected. I am not bothered by the Python-level Exceptions. I am
bothered by the interpreter throwing a segfault. What I suspect is
happening is the Session object is deallocated, while it still has a
reference from within the iterator.
But on your code Session objects are never deleted; they stay inside
System.sessions. Having an extra reference (the session variable) doesnt
matter.
Hmmm. You're right.
It's quite difficult to reproduce these bugs consistently. You might
need to run it a few times.
At least, the problem of using the same generator from different threads
still remains, if you don't use my modified code. In general, when using
multiple threads you always need some way to syncronize access to shared
objects. You are lucky with Sessions because append is an atomic operation
on lists; for more information see http://effbot.org/pyfaq/what-kinds-of-global-value-mutation-are-threa...
Again you're right. But even putting a try-except:return around the
random.choice still manages to break the interpreter. I'm not looking
for any meaningful output really. I just want it not to break.
Like I said, this is just watered down code to try and isolate the
problem.
.
- Follow-Ups:
- Re: threading and iterator crashing interpreter
- From: Rhamphoryncus
- Re: threading and iterator crashing interpreter
- From: Gabriel Genellina
- Re: threading and iterator crashing interpreter
- References:
- threading and iterator crashing interpreter
- From: Janto Dreijer
- Re: threading and iterator crashing interpreter
- From: Gabriel Genellina
- Re: threading and iterator crashing interpreter
- From: Janto Dreijer
- Re: threading and iterator crashing interpreter
- From: Gabriel Genellina
- threading and iterator crashing interpreter
- Prev by Date: Re: Python books?
- Next by Date: Re: a better solution for GUI in python
- Previous by thread: Re: threading and iterator crashing interpreter
- Next by thread: Re: threading and iterator crashing interpreter
- Index(es):
Relevant Pages
|