Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Updike, Clark <Clark.U<pdike@jh...> - 2004-08-02 15:03:31
Here, I asked a similar question about concurrency issues:
I take this to mean that you don't need to synchronize exec since each
invocation supplies a fresh PyFrame to a read-only PyCode object.
However, the typical practice is to use a fresh PythonInterpreter
for each invocation, each with it's own PySystemState. Otherwise,
your threads are sharing a common sys object which is a potential
source of problems. Chapter 12 (pg. 204) of
Regarding killing interpreter threads, this may give you some ideas:
[mailto:jython-users-admin@...] On Behalf Of Mitch M
Sent: Monday, August 02, 2004 9:58 AM
Subject: [Jython-users] kill a timed out python script in multithreaded
ok, pretty new to python. in new job, took over some code, basically, it
spawns a LOT of little python scripts. parent java program is
Current code wraps pythonInterpreter into class which synchronizes
exec() method. Comments says he did this because was concerned about
first, is this a good idea? comments?
Anway, we occassionaly seem to be having a "dead thread" and I wondered if
one of these python scripts is getting into an infinite loop or something
(before you say "go look at them" there are hundreds and hundreds executing
over and over. it's not even really an option to log each entry/exit. The
logs are just too huge. It would kill performance, which is already a
problem in production and it only occurrs in production.. So my thought was
to put a timer (maybe launch a class which sleeps and then kills the thread
once the scripts executes)
and then kill the nonresponding python script.
So how do I do this. I see a PySystemState.exit() but this is a STATIC
method. So wouldn't it kill ALL executing scripts (remember, even though
this method is synchronized, there are other java threads, so wouldn't there
be others executing?).
Any thoughts/opinions would be appreciated.
Planning a family vacation? Check out the MSN Family Travel guide!
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one
more big change to announce. We are now OSTG- Open Source Technology Group.
Come see the changes on the new OSTG site. http://www.ostg.com
Jython-users mailing list