Re: threading and iterator crashing interpreter



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.

.



Relevant Pages

  • Re: Intranet Login using ASPdotNET (advice)...
    ... You should read a bit about FormsAuthentication ... limit the scope of the session object? ... You should use the Session object, the Cache object has a different ... How do I set the session to expire in XX minutes? ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Access session of another user
    ... user's session by a session id or user id, ... I strongly recommend you to use the Profile ... Profile object is persistent whereas Session object is non-persistent. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Classes / Functions / Autonomy
    ... Session creation should be called from the Validate function, ... Session Object. ... Class Celebrity { ...
    (comp.lang.php)
  • Re: pls help w/cookies.......
    ... into a session object in the server side). ... the output of the handler servlet contains a link to a viewer ...
    (comp.lang.java.help)
  • ASP Authentication
    ... Googling around, I saw a couple of ways to meet my needs, but all seem to be weak: ... I can check a session number or smth like that on each page...but this does not seem very reliable, ... are guaranteed to be 12 students or less to facilitate one-on-one ...
    (Security-Basics)