Page 1 of 1

Black magic nasty behaviour...

Posted: Tue Aug 04, 2009 6:46 am
by saint
I found by change a black magic nasty behaviour.

Background information:

I sometimes need to stop oolite without closing the program (pause still eats CPU), I usually start oolite from the WindowMaker menu so I can't type ^Z and suspend it.

I tried to use STOP and CONT signals: first a grep on ps output to find the oolite pid, then a 'kill -s(STOP|CONT)' to that process to stop/restart the program.

Since I am lazy, I decided to write this small script

Code: Select all

#!/bin/sh

kill -s STOP `ps -fu $LOGNAME | grep oolite | grep -v grep | awk '{ print $2 }'`
with a dual script that sends the CONT signal. Yes, I know, I should have written a single script either checking $0 or accepting an option for start and stop. But that's not the point.

The point is that it seems that there's a lock somewhere that cause oolite and X11 to deadlock. I thought it was due oolite log going to the console, but got the freeze with an oolite instance launched from the terminal.

The black magic is that if I find the pid with a grep

Code: Select all

ps -fu saint | grep oolite
and then I type

Code: Select all

kill -s STOP /the pid I got with the previous command/
everything works fine....

Posted: Tue Aug 04, 2009 3:47 pm
by zevans
Hm, in case there's something strange with using backquotes... have you tried using

Code: Select all

killall -S STOP oolite
instead of the grep and awk?

Posted: Thu Aug 06, 2009 9:06 am
by saint
zevans wrote:
Hm, in case there's something strange with using backquotes... have you tried using

Code: Select all

killall -S STOP oolite
instead of the grep and awk?
Not killall, but pkill yes, and does not freeze. BLACK MAGIC???!!!
Nope. If I substitute 'kill' with /bin/kill and DO NOT attempt to log kill execution, it does not freeze. If I try to log /bin/kill execution with something like >> file 2>>&1 ... freeze

pkill does not suffer of this problem. And that's enought for me, I have no resource to investigate this interesting magic anymore :(. Maybe in the forthcoming holidays...

Posted: Thu Aug 06, 2009 1:33 pm
by zevans
Maybe something wants input and stops because it isn't on an interactive session?

Posted: Thu Aug 06, 2009 1:42 pm
by saint
Sounds more a deadlock. If I send a sigkill or sigcont to oolite (that is: if I kill the program or send it the "continue processing" signal) X11 unfreezes.

When i say that it freezes I mean that It does not listen to event, the mouse fozen on its tracks, and freezes all output, i.e. the little animations in the dock freeze still.