Black magic nasty behaviour...

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
saint
Dangerous
Dangerous
Posts: 75
Joined: Fri Jul 24, 2009 5:17 pm
Location: 45.371747 N, 12.011885 E - Sol III
Contact:

Black magic nasty behaviour...

Post 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....
Image
Cmdr. Saint, Golden Gladstone with 4 leaves Clovers of the Most Noble Order or The B.D.c.
zevans
---- E L I T E ----
---- E L I T E ----
Posts: 332
Joined: Mon Jul 06, 2009 11:12 pm
Location: Uncharted backwaters of the unfashionable end of the western spiral arm

Post 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?
User avatar
saint
Dangerous
Dangerous
Posts: 75
Joined: Fri Jul 24, 2009 5:17 pm
Location: 45.371747 N, 12.011885 E - Sol III
Contact:

Post 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...
Image
Cmdr. Saint, Golden Gladstone with 4 leaves Clovers of the Most Noble Order or The B.D.c.
zevans
---- E L I T E ----
---- E L I T E ----
Posts: 332
Joined: Mon Jul 06, 2009 11:12 pm
Location: Uncharted backwaters of the unfashionable end of the western spiral arm

Post by zevans »

Maybe something wants input and stops because it isn't on an interactive session?
User avatar
saint
Dangerous
Dangerous
Posts: 75
Joined: Fri Jul 24, 2009 5:17 pm
Location: 45.371747 N, 12.011885 E - Sol III
Contact:

Post 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.
Image
Cmdr. Saint, Golden Gladstone with 4 leaves Clovers of the Most Noble Order or The B.D.c.
Post Reply