Bug: 'ps' utility hangs system

I have encountered very strange behaviour of utility ‘ps’:

When I debug program using wd 10.6 under QNX Windows and the debugged
program uses function calls like spawn() and qnx_getids(), and I launch
‘ps’ utility from another console, system hangs. That means at least QNX
Windows and network stop working.

When I use ‘sin’ utility, there is no problem.

What is the cause ?

Is there any difference between the messages exchanged by ‘sin’ and ‘Proc’
in comparison with the messages exchanged by ‘ps’ and ‘Proc’ ?

I use following QNX 4.25 J, ‘sin ver’ shows following information:
Proc 4.25J
Slib16 4.23G
Slib32 4.24B
QWindows 4.21B


A magic piece of code :

// arguments had the appropriate form (arg0=taskname arg1 … NULL)
// during the tests

static int spawn_task(
const char **arguments
)
{
pid_t pid;
int time;
struct _psinfo2 info;

if( !arguments ) return -1;
if( !arguments[ 0 ] ) return -1;
if( ( pid = ( pid_t ) spawnv( P_NOWAIT, args[0], args ) ) == -1 )
return -1;
for( time = 0; time < kill_time; time += watch_time ) {
sleep( watch_time );
if( qnx_getids( pid, &info ) == -1 ) {
// child already finished
return 0;
}
}
kill( pid, SIGKILL );

printf( “Timeout for %s expired, process %d killed”,
arguments[ 0 ], pid );
return -1;
}


\

Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
Tel: ++421 7 60291 816
e-mail:matog@microstep-mis.sk

Martin Gazak <matog@microstep-mis.sk> wrote:

I have encountered very strange behaviour of utility ‘ps’:

If you do a “sin arg” instead of “ps”, does that hand as well?

When I debug program using wd 10.6 under QNX Windows and the debugged
program uses function calls like spawn() and qnx_getids(), and I launch
‘ps’ utility from another console, system hangs. That means at least QNX
Windows and network stop working.

When I use ‘sin’ utility, there is no problem.

What is the cause ?

Is there any difference between the messages exchanged by ‘sin’ and ‘Proc’
in comparison with the messages exchanged by ‘ps’ and ‘Proc’ ?

ps, by default, tries to get the command line parameters, while sin doesn’t.
To do this, ps uses the qnx_debug_xfer() code to get that information – but
wd also uses those to get & control the debugged process – there may be
a problem with two processes trying to get debug access to a third.

If “sin ar” shows this problem as well, it becomes more likely that is
the culprit – “sin ar” also uses the qnx_debug_xfer() call to get the
command line argument information.

-David

QNX Training Services
dagibbs@qnx.com

David Gibbs <dagibbs@qnx.com> wrote:

Martin Gazak <> matog@microstep-mis.sk> > wrote:
I have encountered very strange behaviour of utility ‘ps’:

If you do a “sin arg” instead of “ps”, does that hand as well?

“sin args” works properly. Even “ps” works properly, when I debug another
program. I did not managed to simulate this process/state under different
conditions.

ps, by default, tries to get the command line parameters, while
sin doesn’t.
To do this, ps uses the qnx_debug_xfer() code to get that information
– but wd also uses those to get & control the debugged process –
there may be a problem with two processes trying to get debug access
to a third.

If “sin ar” shows this problem as well, it becomes more likely that is
the culprit – “sin ar” also uses the qnx_debug_xfer() call to get the
command line argument information.

-David

QNX Training Services
dagibbs@qnx.com

Martin Gazak <matog@nod10.mstep> wrote:

David Gibbs <> dagibbs@qnx.com> > wrote:
Martin Gazak <> matog@microstep-mis.sk> > wrote:
I have encountered very strange behaviour of utility ‘ps’:

If you do a “sin arg” instead of “ps”, does that hand as well?

“sin args” works properly. Even “ps” works properly, when I debug another
program. I did not managed to simulate this process/state under different
conditions.

Oh well, so much for my guess as to what the difference between the two
was that might be causing the problem.

Maybe someone else will have an idea – I don’t.

-David

QNX Training Services
dagibbs@qnx.com