webware-discuss

I'm having trouble stopping (and therefore restarting) webkit on my debian
box.
I'm running python2.2, and the release webware 0.7.
Here's what happens if I run the AppServer manually:
Shutdown Called Thu May 9 20:23:03 2002
ThreadedAppServer: Shutting Down
Shutting down the AppServer
Application is Shutting Down
Application has been succesfully shutdown.
AppServer has been shutdown
Unhandled exception in thread:
Traceback (most recent call last):
File "/usr/lib/python2.2/threading.py", line 423, in __bootstrap
self.__stop()
File "/usr/lib/python2.2/threading.py", line 432, in __stop
self.__block.notifyAll()
File "/usr/lib/python2.2/threading.py", line 242, in notifyAll
self.notify(len(self.__waiters))
File "/usr/lib/python2.2/threading.py", line 224, in notify
me = currentThread()
TypeError: 'NoneType' object is not callable
If I use the /etc/init.d/webkit stop command, it stop the AppServer itself,
but the python tasks that it launched don't exit. The error above does NOT
show up in /var/log/webkit, nor does any other message when I do the
'/etc/init.d/webkit stop'.
If I manually run "python Launch.py ThreadedAppServer.py stop" I get this:
Traceback (most recent call last):
File "Launch.py", line 24, in ?
main(sys.argv)
File "Launch.py", line 20, in main
WebKit.Launch.launchWebKit(args[1], appWorkPath, args[2:])
File "Launch.py", line 35, in launchWebKit
main(sys.argv)
File "./WebKit/ThreadedAppServer.py", line 682, in main
File "./WebKit/AppServer.py", line 305, in stop
OSError: [Errno 3] No such process
I'm not certain at all that they are related, but it seems probable.
Has anybody seen this?
Thanks.

| I also see this traceback occasionally when I'm running WebKit in
| a shell on
| Linux and stop it by pressing Ctrl-C. It only happens about 10%
| of the time.
| I don't know why it happens.
Are you still able to stop the running AppServer though? /etc/init.d/webkit
stop kills the AppServer process, but not the actualy python processes.
| Matt, it might be worth posting to comp.lang.python and asking if there's
| some reason why this message would appear. Maybe someone familiar with
| Python's threading module can answer.
Good idea. If I get anything good, I'll add it to this thread.
Thanks.

On Saturday May 18, 2002 12:13 pm, Matt Feifarek wrote:
> | I also see this traceback occasionally when I'm running WebKit in
> | a shell on
> | Linux and stop it by pressing Ctrl-C. It only happens about 10%
> | of the time.
> | I don't know why it happens.
>
> Are you still able to stop the running AppServer though? /etc/init.d/webkit
> stop kills the AppServer process, but not the actualy python processes.
Yes. I'm running the AppServer by typing "./AppServer" in the WebKit
directory, and I'm stopping it by pressing Ctrl-C. Even if I see that
traceback, it still exits all Python processes.
- Geoff

| Yes. I'm running the AppServer by typing "./AppServer" in the WebKit
| directory, and I'm stopping it by pressing Ctrl-C. Even if I see that
| traceback, it still exits all Python processes.
Yeah, I get that, too, but if I use the init.d script, it won't kill the
processes. Maybe it's a permissions thing. I thought I looked into that,
I'll have to poke around some more.

> | Yes. I'm running the AppServer by typing "./AppServer" in the WebKit
> | directory, and I'm stopping it by pressing Ctrl-C. Even if I see that
> | traceback, it still exits all Python processes.
>
> Yeah, I get that, too, but if I use the init.d script, it won't kill t
> he
> processes. Maybe it's a permissions thing. I thought I looked into that,
> I'll have to poke around some more.
>
I'm using a AppWorkDir. With that I couldn't use the PID from the init
script, but the one from the AppServer script that is located in the
Application working directory. This might also happen in the general case.
Please see
http://webware.colorstudy.net/twiki/bin/view/Webware/MakeAppWorkDir
I've seen even more strange things when shutting down the AppServer:
I'm using a MySql database connection in a Servlet. When shuting down,
sometimes I get the following errormessage:
-----------------------------------------------------------------------------------------------------
Shutdown Called Mon May 20 12:47:46 2002
ThreadedAppServer: Shutting Down
Shutting down the AppServer
Application is Shutting Down
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/local/lib/python2.2/threading.py", line 408, in __bootstrap
self.run()
File "/usr/local/lib/python2.2/threading.py", line 396, in run
apply(self.__target, self.__args, self.__kwargs)
File "./WebKit/AppServer.py", line 86, in closeThread
File "./WebKit/ThreadedAppServer.py", line 318, in shutDown
File "./WebKit/AppServer.py", line 119, in shutDown
File "/usr/local/Webware/WebKit/Application.py", line 236, in shutDown
self._sessions.storeAllSessions()
File "./WebKit/SessionMemoryStore.py", line 61, in storeAllSessions
File "./WebKit/SessionFileStore.py", line 77, in __setitem__
UnpickleableError: Cannot pickle <type 'connection'> objects
./AppServerStandalone: line 3: 1952 Segmentation fault /usr/bin/env
python Launch.py ThreadedAppServer $*
-----------------------------------------------------------------------------------------------------------------------
Since I'm shutting down anyway, I can live with that, but when trying to
restart, I get:
------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "./WebKit/ThreadedAppServer.py", line 566, in run
File "./WebKit/ThreadedAppServer.py", line 66, in __init__
File "./WebKit/AppServer.py", line 59, in __init__
File "./WebKit/AppServer.py", line 145, in createApplication
File "/usr/local/Webware/WebKit/Application.py", line 167, in __init__
self._sessions = klass(self)
File "./WebKit/SessionMemoryStore.py", line 23, in __init__
File "./WebKit/SessionFileStore.py", line 55, in __getitem__
KeyError: 20020516184304-22fe80bb69e684b25d77788c2363dfd6
---------------------------------------------------------------------------------------------------------------------------
I have then to clean out the "Session" directory.
I'm not on the latest CVS version at the moment, so it might be my problem.
Anyway, I'm using Webware 0.7 (something) on Linux.
If this is a general problem, I'd suggest that the startup process will
ignore (delete) session files, that cause problems

In http://mail.python.org/pipermail/python-dev/2001-October/017799.html
Guido remarks:
Python doesn't attempt to stop daemon threads at all. Note that the
__stop() call is in a finally clause. This probably gets hit because
some other exception happened (caused by the same problem of globals
being replaced by None).
If I trap the currentThread call at line 223 in threading.py,
I find that I can't call currentThread, can't invoke _DummyThread,
so I just forget about it and proceed along and everything
still "works":
def notify(self, n=1):
try:
me = currentThread()
except TypeError,e:
print e
#print "currentThread(): no current thread for", _get_ident()
print "currentThread(): no current thread, probably can't
call _get_ident()"
print "Can't Give it a dummy thread, what to do?"
#me= _DummyThread()
None of the assert self._is_owned, __waiters=self.__waiters,etc.
stuff that follows throws an exception
Now, the purpose of _DummyThread seems to be to
represent for foreign threads, including daemon threads,
to say "don't wait for me". If AppServer is not
started as a daemon, this doesn't seem to be necessary
(unless it's extended at some point to communicate
with foreign threads). If it is started as a daemon,
it detaches from the keyboard, so you shouldn't get
these keyboard errors.
One possibly pertinent note:
# When the main thread exits, it does not do any of its usual
cleanup
(except that try ... finally clauses are honored), and the standard I/O
files are not flushed.
Also, the keyboard error seems to happen
a lot less with Python 2.2.1 than Python 2.2,
but still up around 1 out of 10 or so.
Stephan Diehl wrote:
>>| Yes. I'm running the AppServer by typing "./AppServer" in the WebKit
>>| directory, and I'm stopping it by pressing Ctrl-C. Even if I see that
>>| traceback, it still exits all Python processes.
>>
>>Yeah, I get that, too, but if I use the init.d script, it won't kill t
>>he
>>processes. Maybe it's a permissions thing. I thought I looked into that,
>>I'll have to poke around some more.
>>
>
>
>
> I'm using a AppWorkDir. With that I couldn't use the PID from the init
> script, but the one from the AppServer script that is located in the
> Application working directory. This might also happen in the general case.
> Please see
> http://webware.colorstudy.net/twiki/bin/view/Webware/MakeAppWorkDir
>
> I've seen even more strange things when shutting down the AppServer:
> I'm using a MySql database connection in a Servlet. When shuting down,
> sometimes I get the following errormessage:
> -----------------------------------------------------------------------------------------------------
>
> Shutdown Called Mon May 20 12:47:46 2002
> ThreadedAppServer: Shutting Down
> Shutting down the AppServer
> Application is Shutting Down
> Exception in thread Thread-2:
> Traceback (most recent call last):
> File "/usr/local/lib/python2.2/threading.py", line 408, in __bootstrap
> self.run()
> File "/usr/local/lib/python2.2/threading.py", line 396, in run
> apply(self.__target, self.__args, self.__kwargs)
> File "./WebKit/AppServer.py", line 86, in closeThread
> File "./WebKit/ThreadedAppServer.py", line 318, in shutDown
> File "./WebKit/AppServer.py", line 119, in shutDown
> File "/usr/local/Webware/WebKit/Application.py", line 236, in shutDown
> self._sessions.storeAllSessions()
> File "./WebKit/SessionMemoryStore.py", line 61, in storeAllSessions
> File "./WebKit/SessionFileStore.py", line 77, in __setitem__
> UnpickleableError: Cannot pickle <type 'connection'> objects
>
> ./AppServerStandalone: line 3: 1952 Segmentation fault /usr/bin/env
> python Launch.py ThreadedAppServer $*
>
> -----------------------------------------------------------------------------------------------------------------------
>
> Since I'm shutting down anyway, I can live with that, but when trying to
> restart, I get:
>
> ------------------------------------------------------------------------------------------------------------------------
>
> Traceback (most recent call last):
> File "./WebKit/ThreadedAppServer.py", line 566, in run
> File "./WebKit/ThreadedAppServer.py", line 66, in __init__
> File "./WebKit/AppServer.py", line 59, in __init__
> File "./WebKit/AppServer.py", line 145, in createApplication
> File "/usr/local/Webware/WebKit/Application.py", line 167, in __init__
> self._sessions = klass(self)
> File "./WebKit/SessionMemoryStore.py", line 23, in __init__
> File "./WebKit/SessionFileStore.py", line 55, in __getitem__
> KeyError: 20020516184304-22fe80bb69e684b25d77788c2363dfd6
>
> ---------------------------------------------------------------------------------------------------------------------------
>
> I have then to clean out the "Session" directory.
> I'm not on the latest CVS version at the moment, so it might be my problem.
> Anyway, I'm using Webware 0.7 (something) on Linux.
>
> If this is a general problem, I'd suggest that the startup process will
> ignore (delete) session files, that cause problems
>
>
> _______________________________________________________________
> Hundreds of nodes, one monster rendering program.
> Now that's a super model! Visit http://clustering.foundries.sf.net/
>
> _______________________________________________
> Webware-discuss mailing list
> Webware-discuss@...
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
--
Bill Eldridge
Radio Free Asia
bill@...

| I'm using a AppWorkDir. With that I couldn't use the PID from the init
| script, but the one from the AppServer script that is located in the
| Application working directory. This might also happen in the general case.
| Please see
| http://webware.colorstudy.net/twiki/bin/view/Webware/MakeAppWorkDir
Thanks, Stephan, this pretty much worked.
I did have to change one more line in the init script though,
I had to remove the output redirection from this line:
su -c "$LAUNCH" webware &
Otherwise it would create a webkit.log file as root before the AppServer
script got to it, which would then not have permissions to write into
webkit.log. I'm running my AppServer as user webware, which you may not be
doing.
Since you moved the logging stuff into the AppServer script anyway, it
works.
The threading exception still shows up in the webkit.log when you shut down,
but at least it shuts down.

Geoffrey Talvola wrote:
>
> On Saturday May 18, 2002 12:13 pm, Matt Feifarek wrote:
> > | I also see this traceback occasionally when I'm running WebKit in
> > | a shell on
> > | Linux and stop it by pressing Ctrl-C. It only happens about 10%
> > | of the time.
> > | I don't know why it happens.
> >
> > Are you still able to stop the running AppServer though? /etc/init.d/webkit
> > stop kills the AppServer process, but not the actualy python processes.
>
> Yes. I'm running the AppServer by typing "./AppServer" in the WebKit
> directory, and I'm stopping it by pressing Ctrl-C. Even if I see that
> traceback, it still exits all Python processes.
Found another possible blame-point in the Python 2.2.1
change logs:
- threading: make Condition.wait() robust against KeyboardInterrupt.
I have 2.2.1 installed at work - I'll test this tomorrow.
I can confirm at home that it happens much more than 10% of the time.
--
Bill Eldridge
Radio Free Asia
bill@...

Hate to play the upgrade shuffle,
but I had a couple of Python packages
that had lots of problems with a Python
version I was running maybe from January
that went away with an upgrade I did
in April. I'd recommend Python 2.2.1
before spending too much time on this.
What this looks like off-hand is that
the currentThread has already been killed
off when it tries to send out notice
that it's killing off all the threads.
However, this is the only possibly related
bugfix I see in the release notes though:
- The SocketServer.ThreadingMixIn class now closes the request after
finish_request() returns. (Not when it errors out though.)
http://www.python.org/2.2.1/NEWS.txt
Geoffrey Talvola wrote:
>
> On Thursday May 09, 2002 08:37 pm, Matt Feifarek wrote:
> > I'm having trouble stopping (and therefore restarting) webkit on my debian
> > box.
> >
> > I'm running python2.2, and the release webware 0.7.
> >
> > Here's what happens if I run the AppServer manually:
> >
> > Shutdown Called Thu May 9 20:23:03 2002
> > ThreadedAppServer: Shutting Down
> > Shutting down the AppServer
> > Application is Shutting Down
> > Application has been succesfully shutdown.
> > AppServer has been shutdown
> > Unhandled exception in thread:
> > Traceback (most recent call last):
> > File "/usr/lib/python2.2/threading.py", line 423, in __bootstrap
> > self.__stop()
> > File "/usr/lib/python2.2/threading.py", line 432, in __stop
> > self.__block.notifyAll()
> > File "/usr/lib/python2.2/threading.py", line 242, in notifyAll
> > self.notify(len(self.__waiters))
> > File "/usr/lib/python2.2/threading.py", line 224, in notify
> > me = currentThread()
> > TypeError: 'NoneType' object is not callable
>
> I also see this traceback occasionally when I'm running WebKit in a shell on
> Linux and stop it by pressing Ctrl-C. It only happens about 10% of the time.
> I don't know why it happens.
>
> Matt, it might be worth posting to comp.lang.python and asking if there's
> some reason why this message would appear. Maybe someone familiar with
> Python's threading module can answer.
>
> - Geoff
>
> _______________________________________________________________
> Hundreds of nodes, one monster rendering program.
> Now that's a super model! Visit http://clustering.foundries.sf.net/
>
> _______________________________________________
> Webware-discuss mailing list
> Webware-discuss@...
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
--
Bill Eldridge
Radio Free Asia
bill@...

| version I was running maybe from January
| that went away with an upgrade I did
| in April. I'd recommend Python 2.2.1
| before spending too much time on this.
I'm running 2.2.1, specifically 2.2.1-5 debian package from "unstable". I
have been running it all along (so I originally noticed this problem under
2.2.1).
I get the exception nearly every time, not just 10%. I'd say 90%.
Some more details:
---------------------------------------
If I do what Geoff is doing:
./AppServer
and then CTRL-C, I get the exception that we've been talking about:
Shutdown Called Sun May 19 15:18:58 2002
ThreadedAppServer: Shutting Down
Shutting down the AppServer
Application is Shutting Down
Application has been succesfully shutdown.
AppServer has been shutdown
Unhandled exception in thread:
Traceback (most recent call last):
File "/usr/lib/python2.2/threading.py", line 423, in __bootstrap
self.__stop()
File "/usr/lib/python2.2/threading.py", line 432, in __stop
self.__block.notifyAll()
File "/usr/lib/python2.2/threading.py", line 242, in notifyAll
self.notify(len(self.__waiters))
File "/usr/lib/python2.2/threading.py", line 224, in notify
me = currentThread()
TypeError: 'NoneType' object is not callable
---------------------------------------
If I do:
./AppServer &
I get a ps tree like this:
14649 pts/2 S 0:00 /bin/sh ./AppServer
14650 pts/2 S 0:01 python Launch.py ThreadedAppServer
14652 pts/2 S 0:00 python Launch.py ThreadedAppServer
14653 pts/2 S 0:00 python Launch.py ThreadedAppServer
14654 pts/2 S 0:00 python Launch.py ThreadedAppServer
14655 pts/2 S 0:00 python Launch.py ThreadedAppServer
14656 pts/2 S 0:00 python Launch.py ThreadedAppServer
14657 pts/2 S 0:00 python Launch.py ThreadedAppServer
14658 pts/2 S 0:00 python Launch.py ThreadedAppServer
14659 pts/2 S 0:00 python Launch.py ThreadedAppServer
now, here's where it gets interesting.
I do a:
kill 14649
and 14649 does indeed go away, and a few of the other tasks go away (55,57).
This varies somewhat from time to time; sometimes they all stay, sometimes a
couple or a few go away with the AppServer process.
now, I do a:
kill 14650
and get:
Shutdown Called Sun May 19 15:25:25 2002
ThreadedAppServer: Shutting Down
Shutting down the AppServer
Application is Shutting Down
Application has been succesfully shutdown.
AppServer has been shutdown
Unhandled exception in thread:
Traceback (most recent call last):
File "/usr/lib/python2.2/threading.py", line 423, in __bootstrap
self.__stop()
File "/usr/lib/python2.2/threading.py", line 432, in __stop
self.__block.notifyAll()
File "/usr/lib/python2.2/threading.py", line 242, in notifyAll
self.notify(len(self.__waiters))
File "/usr/lib/python2.2/threading.py", line 224, in notify
me = currentThread()
TypeError: 'NoneType' object is not callable
---------------------------------------
So, it seems that somehow the AppServer script isn't sending the kill to the
other threads, as has been hypothesized. When I DO get the stop command to
the right thread, the exception is thrown.
I hope this helps. Let me know if I can run more tests for you guys that may
help.
Another thing that I noticed, is that if I change the number of threads
launched in Configs/AppServer.config to 5, I still get 9 threads launched.
Don't know if this is involved at all...
Geoff, I haven't sent this in to c.l.python, because I'm not convinced yet
that it's not something to do with AppServer. At the least, it seems like
two separate problems: AppServer not sending shutdown to the threads, and
the threads not shutting down gracefully when they finally do get the
command.
Thanks, guys.

Matt Feifarek wrote:
> TypeError: 'NoneType' object is not callable
> ---------------------------------------
>
> So, it seems that somehow the AppServer script isn't sending the kill to the
> other threads, as has been hypothesized. When I DO get the stop command to
> the right thread, the exception is thrown.
Someone noted:
This traceback does not appear when I register an atexit
function to stop the thread.
Wanna try throwing in a simple atexit print handler?
--
Bill Eldridge
Radio Free Asia
bill@...

On Sat, 2002-05-18 at 10:30, Geoffrey Talvola wrote:
> On Thursday May 09, 2002 08:37 pm, Matt Feifarek wrote:
> > I'm having trouble stopping (and therefore restarting) webkit on my debian
> > box.
> >
> > I'm running python2.2, and the release webware 0.7.
> >
> > Here's what happens if I run the AppServer manually:
> >
> > Shutdown Called Thu May 9 20:23:03 2002
> > ThreadedAppServer: Shutting Down
> > Shutting down the AppServer
> > Application is Shutting Down
> > Application has been succesfully shutdown.
> > AppServer has been shutdown
> > Unhandled exception in thread:
> > Traceback (most recent call last):
> > File "/usr/lib/python2.2/threading.py", line 423, in __bootstrap
> > self.__stop()
> > File "/usr/lib/python2.2/threading.py", line 432, in __stop
> > self.__block.notifyAll()
> > File "/usr/lib/python2.2/threading.py", line 242, in notifyAll
> > self.notify(len(self.__waiters))
> > File "/usr/lib/python2.2/threading.py", line 224, in notify
> > me = currentThread()
> > TypeError: 'NoneType' object is not callable
>
> I also see this traceback occasionally when I'm running WebKit in a shell on
> Linux and stop it by pressing Ctrl-C. It only happens about 10% of the time.
> I don't know why it happens.
>
> Matt, it might be worth posting to comp.lang.python and asking if there's
> some reason why this message would appear. Maybe someone familiar with
> Python's threading module can answer.
While doing some other work on Webware today I had this error, too, and
a google search turned up this thread on the mailing list. I was able
to reproduce this traceback fairly consistently, and so it was possible
to track down the cause (mainly by enabling verbose mode in
threading.py, and then poring through the output, keeping track of all
the thread starts/stops) and fix it.
What is happening is that the python interpreter is exiting before the
task manager thread (scheduler) has completely exited. Thus, when the
task manager thread tries to call currentThread() it gets an error
because this function no longer exists.
The interpreter is exiting because the task manager runs in daemon mode
and is the only thread remaining at this point (The python docs do
indeed say that the program will exit when no non-daemon threads exist).
One solution would be not to run this thread in daemon mode. I'm not
sure if that has any other ramifications, though, so I didn't take that
route.
Instead, I simply do a join() on the scheduler thread in
Scheduler.stop(), so that we can be sure it is completely finished
before we continue the shutdown.
I've just committed this to CVS.
--
Jason D. Hildebrand
jason@...

I just posted a new version of the Webware pop-up calendar tutorial that
I mentioned here about 5 months ago.
I rushed the end because I wanted to put it up, but take a look and let
me know what you think.
http://webware.metrony.com/tutorials/calPopUp.html
-Aaron

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

CountryState

JavaScript is required for this form.

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details