Vilem Pantucek
|
HAM - problem with attaching of runnig process to ham
|
Vilem Pantucek
06/16/2010 10:26 AM
post56968
|
HAM - problem with attaching of runnig process to ham
Hello,
I wrote program ham_add, that attaches the test process to a HAM, and then establishes a condition death
and an action restart under it.
if (argc > 1)
inetdpath = strdup(argv[1]);
else
inetdpath = strdup("test");
if (argc > 2)
inetdpid = atoi(argv[2]);
else
inetdpid = -1;
if((retval = ham_connect(0)) == -1)
{
fprintf(stderr, "ham_connect: error:%d - %s\n", errno, strerror(errno));
return;
}
ehdl = ham_attach("test", ND_LOCAL_NODE, inetdpid, inetdpath, 0);
if (ehdl != NULL)
{
chdl = ham_condition(ehdl,CONDDEATH, "death", HREARMAFTERRESTART);
if (chdl != NULL)
{
ahdl = ham_action_restart(chdl, "restart", inetdpath, HREARMAFTERRESTART);
if (ahdl == NULL)
printf("add action failed\n");
}
else
printf("add condition failed\n");
}
else
printf("add entity failed\n");
ham_disconnect(0);
In your help to ham_attach() function is writen:
You use the ham_attach() to attach an entity to the HAM.
An entity can be any process on the system. You can use this function to:
1/ tell the HAM to start a process and then add it as an entity to its context. (this work's fine)
2/ attach a process that's already running
Problem:
Case ad2/ dosn't work. I run "./test" "./ham_add test pid_of_test". Ham apears, that all is OK, but when I
kill test, ham doesn't restart test. In case ad1/ it work's fine.
All source code, ham dump and information under the /proc/ham are in attached file.
ham_add_test.txt - print out from ham -vvvvv in case ad1/
ham_add_test_pid.txt - print out from ham -vvvvv in case ad2/
Wath's wrong, can anybody help me solve this problem? Thank's.
Regard.
Ales
|
|
|
Shiv Nagarajan(deleted)
|
RE: HAM - problem with attaching of runnig process to ham
|
Shiv Nagarajan(deleted)
06/16/2010 10:59 AM
post56978
|
RE: HAM - problem with attaching of runnig process to ham
HAM can detect the death of the following types of processes in the system
a) self attached entities
b) processes in session 1 (processes that have become daemons, by calling procmgr_daemon)
c) processes that die abnormally (i.e. die via a core dump, and dumper is running on the target)
Can you post the output of ham -vvvvv when you kill test, in both the success and the failure cases?
the output now just shows the output when the conditions have been added, but not when the process death occurs.
What signal are you sending to test to kill it. Is dumper running on the target?
the verbose output of HAM will show the death and restart of the process, in both cases ad1 and ad2. So that output will
tell us the difference between the two cases and why things don't work
thanks
shiv
-----Original Message-----
From: Vilem Pantucek [mailto:community-noreply@qnx.com]
Sent: Wed 6/16/2010 10:26 AM
To: ostech-core_os
Subject: HAM - problem with attaching of runnig process to ham
Hello,
I wrote program ham_add, that attaches the test process to a HAM, and then establishes a condition death
and an action restart under it.
if (argc > 1)
inetdpath = strdup(argv[1]);
else
inetdpath = strdup("test");
if (argc > 2)
inetdpid = atoi(argv[2]);
else
inetdpid = -1;
if((retval = ham_connect(0)) == -1)
{
fprintf(stderr, "ham_connect: error:%d - %s\n", errno, strerror(errno));
return;
}
ehdl = ham_attach("test", ND_LOCAL_NODE, inetdpid, inetdpath, 0);
if (ehdl != NULL)
{
chdl = ham_condition(ehdl,CONDDEATH, "death", HREARMAFTERRESTART);
if (chdl != NULL)
{
ahdl = ham_action_restart(chdl, "restart", inetdpath, HREARMAFTERRESTART);
if (ahdl == NULL)
printf("add action failed\n");
}
else
printf("add condition failed\n");
}
else
printf("add entity failed\n");
ham_disconnect(0);
In your help to ham_attach() function is writen:
You use the ham_attach() to attach an entity to the HAM.
An entity can be any process on the system. You can use this function to:
1/ tell the HAM to start a process and then add it as an entity to its context. (this work's fine)
2/ attach a process that's already running
Problem:
Case ad2/ dosn't work. I run "./test" "./ham_add test pid_of_test". Ham apears, that all is OK, but when I
kill test, ham doesn't restart test. In case ad1/ it work's fine.
All source code, ham dump and information under the /proc/ham are in attached file.
ham_add_test.txt - print out from ham -vvvvv in case ad1/
ham_add_test_pid.txt - print out from ham -vvvvv in case ad2/
Wath's wrong, can anybody help me solve this problem? Thank's.
Regard.
Ales
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post56968
|
|
|
Vilem Pantucek
|
Re: RE: HAM - problem with attaching of runnig process to ham
|
Vilem Pantucek
06/17/2010 5:20 AM
post57049
|
Re: RE: HAM - problem with attaching of runnig process to ham
When I kill test in case ad2 noting heappens, test isn't restarted and any output (print) from ham.
The verbose output from HAM is in attached file.
for test kill I use
#slay test
without params, it means default signal 15 is send to test
/usr/include/signal.h:#define SIGTERM 15 /* software termination signal from kill */
dump is running:
172047 1 usr/sbin/dumper 10o RECEIVE 1
172047 dumper -d /var/dumps
I tray another program ham_pulse.c for delivering pulse when test die, but result is same as in case of test restar.
Case ad1 work's fine and in case ad2 doesn't come the pulse from ham.
I tray it on nto 6.4.1 and 6.3.2, and result is same.
Ales
|
|
|
Aaron Cripps
|
Re: HAM - problem with attaching of runnig process to ham
|
Aaron Cripps
06/17/2010 9:41 AM
post57073
|
Re: HAM - problem with attaching of runnig process to ham
slay uses SIGTERM to kill off the process (by default), which is
considered a regular termination.
Try usung an unusual signal like SIGABRT, SIGHUP, or SIGKILL and let us
know what happens.
-Aaron
On 06/17/2010 05:20 AM, Vilem Pantucek wrote:
> When I kill test in case ad2 noting heappens, test isn't restarted and any output (print) from ham.
>
> The verbose output from HAM is in attached file.
>
> for test kill I use
> #slay test
> without params, it means default signal 15 is send to test
> /usr/include/signal.h:#define SIGTERM 15 /* software termination signal from kill */
>
> dump is running:
> 172047 1 usr/sbin/dumper 10o RECEIVE 1
> 172047 dumper -d /var/dumps
>
> I tray another program ham_pulse.c for delivering pulse when test die, but result is same as in case of test restar.
Case ad1 work's fine and in case ad2 doesn't come the pulse from ham.
>
> I tray it on nto 6.4.1 and 6.3.2, and result is same.
>
> Ales
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post57049
|
|
|
Vilem Pantucek
|
Re: HAM - problem with attaching of runnig process to ham
|
Vilem Pantucek
06/18/2010 6:17 AM
post57133
|
Re: HAM - problem with attaching of runnig process to ham
For, all signals SIGTERM, SIGABRT, SIGHUP, or SIGKILL is in case ad2 same result, nothing heappen, any output (print)
from ham.
|
|
|
|