Ji Dong
|
HAM Manger do not work as I expected
|
Ji Dong
09/16/2009 11:09 AM
post38066
|
HAM Manger do not work as I expected
I am planning to make some basic use of HAM manager starting our process, however, I have come across some strange
problem.
The code I have write is:
int main(int argc, char *argv[])
{
ham_entity_t* ehdl;
ham_condition_t* chdl;
ham_action_t* ahdl;
ham_connect(0); //Connect to HAM.
if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0)))
perror("ehdl");
if(!(chdl = ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART)))
perror("chdl");
if(!(ahdl = ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRESTART)))
perror("ahdl");
ham_disconnect(0); //Connect to HAM.
return EXIT_SUCCESS;
}
the program I want to keep restarting is:
int main(int argc, char *argv[]) {
procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
sleep(1);
fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
sleep(1);
return EXIT_SUCCESS;
}
what I am expect is process 2 keep restarting
After I start process, the second process will start
However when the second process exit, nothing happend
The magic thing is, if I "slay syslogd" or "syslogd",
process 2 will be restart once
it seems each time I call or slay syslogd, it will action once
is this a HAM bug, or what I have missing in my second process?
|
|
|
Shiv Nagarajan(deleted)
|
Re: HAM Manger do not work as I expected
|
Shiv Nagarajan(deleted)
09/16/2009 12:52 PM
post38084
|
Re: HAM Manger do not work as I expected
what version are you using.
shiv
Wed Sep 16 12:56:22 EDT 2009
--> According to Ji Dong <--
I am planning to make some basic use of HAM manager starting our
process, however, I have come across some strange problem.
The code I have write is:
int main(int argc, char *argv[])
{
ham_entity_t* ehdl;
ham_condition_t* chdl;
ham_action_t* ahdl;
ham_connect(0); //Connect to HAM.
if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0)))
perror("ehdl");
if(!(chdl =
ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART)))
perror("chdl");
if(!(ahdl =
ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
TART)))
perror("ahdl");
ham_disconnect(0); //Connect to HAM.
return EXIT_SUCCESS;
}
the program I want to keep restarting is:
int main(int argc, char *argv[]) {
procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
sleep(1);
fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
sleep(1);
return EXIT_SUCCESS;
}
what I am expect is process 2 keep restarting
After I start process, the second process will start
However when the second process exit, nothing happend
The magic thing is, if I "slay syslogd" or "syslogd",
process 2 will be restart once
it seems each time I call or slay syslogd, it will action once
is this a HAM bug, or what I have missing in my second process?
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38066
--
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
|
|
|
Hans-Peter Reichert
|
AW: HAM Manger do not work as I expected
|
Hans-Peter Reichert
09/16/2009 3:02 PM
post38105
|
AW: HAM Manger do not work as I expected
is HAM capable of detecting the change of process' state from a regular child to a detached daemon?
when you start the process first, it's a child and you detect starvation through a normal SIGCHLD,
but when the process is doing the procmgr_daemon()
you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
as I can't find any special constants for a daemon in ham_condition()
I am asking how ham would detect whether it's a daemon or a child?
BTW: what happens when you just skip that procmgr_daemon() call?
/hp
-----Ursprüngliche Nachricht-----
Von: Shiv Nagarajan [mailto:community-noreply@qnx.com]
Gesendet: Mi 16.09.2009 18:52
An: ostech-core_os
Cc:
Betreff: Re: HAM Manger do not work as I expected
what version are you using.
shiv
Wed Sep 16 12:56:22 EDT 2009
--> According to Ji Dong <--
I am planning to make some basic use of HAM manager starting our
process, however, I have come across some strange problem.
The code I have write is:
int main(int argc, char *argv[])
{
ham_entity_t* ehdl;
ham_condition_t* chdl;
ham_action_t* ahdl;
ham_connect(0); //Connect to HAM.
if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0)))
perror("ehdl");
if(!(chdl =
ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART)))
perror("chdl");
if(!(ahdl =
ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
TART)))
perror("ahdl");
ham_disconnect(0); //Connect to HAM.
return EXIT_SUCCESS;
}
the program I want to keep restarting is:
int main(int argc, char *argv[]) {
procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
sleep(1);
fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
sleep(1);
return EXIT_SUCCESS;
}
what I am expect is process 2 keep restarting
After I start process, the second process will start
However when the second process exit, nothing happend
The magic thing is, if I "slay syslogd" or "syslogd",
process 2 will be restart once
it seems each time I call or slay syslogd, it will action once
is this a HAM bug, or what I have missing in my second process?
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38066
--
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38084
*******************************************
Harman Becker Automotive Systems GmbH
Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo Hüls, Michael Mauser
Chairman of the Supervisory Board: Ansgar Rempp | Domicile: Karlsbad |
Local Court Mannheim: Register No. 361395
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat
sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail
. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************
|
|
|
Shiv Nagarajan(deleted)
|
Re: HAM Manger do not work as I expected
|
Shiv Nagarajan(deleted)
09/16/2009 3:07 PM
post38107
|
Re: HAM Manger do not work as I expected
the ham registers for the procmgr_event when any daemon process dies.
And then it looks through its list of monitored processes. So it should
be able to detect the death any process that calls procmgr_daemon also.
ham registers for
procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
the reason I wanted to know the version, was because a PR 65295 was
fixed which was an issue similar to this.
shiv
Wed Sep 16 15:10:13 EDT 2009
--> According to Hans-Peter Reichert <--
is HAM capable of detecting the change of process' state from a regular child to a detached daemon?
when you start the process first, it's a child and you detect starvation through a normal SIGCHLD,
but when the process is doing the procmgr_daemon()
you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
as I can't find any special constants for a daemon in ham_condition()
I am asking how ham would detect whether it's a daemon or a child?
BTW: what happens when you just skip that procmgr_daemon() call?
/hp
-----Ursprüngliche Nachricht-----
Von: Shiv Nagarajan [mailto:community-noreply@qnx.com]
Gesendet: Mi 16.09.2009 18:52
An: ostech-core_os
Cc:
Betreff: Re: HAM Manger do not work as I expected
what version are you using.
shiv
Wed Sep 16 12:56:22 EDT 2009
--> According to Ji Dong <--
I am planning to make some basic use of HAM manager starting our
process, however, I have come across some strange problem.
The code I have write is:
int main(int argc, char *argv[])
{
ham_entity_t* ehdl;
ham_condition_t* chdl;
ham_action_t* ahdl;
ham_connect(0); //Connect to HAM.
if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0)))
perror("ehdl");
if(!(chdl =
ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART)))
perror("chdl");
if(!(ahdl =
ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
TART)))
perror("ahdl");
ham_disconnect(0); //Connect to HAM.
return EXIT_SUCCESS;
}
the program I want to keep restarting is:
int main(int argc, char *argv[]) {
procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
sleep(1);
fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
sleep(1);
return EXIT_SUCCESS;
}
what I am expect is process 2 keep restarting
After I start process, the second process will start
However when the second process exit, nothing happend
The magic thing is, if I "slay syslogd" or "syslogd",
process 2 will be restart once
it seems each time I call or slay syslogd, it will action once
is this a HAM bug, or what I have missing in my second process?
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38066
--
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38084
*******************************************
Harman Becker Automotive Systems GmbH
Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo Hüls, Michael Mauser
Chairman of the Supervisory Board: Ansgar Rempp | Domicile: Karlsbad |
Local Court Mannheim: Register No. 361395
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat
sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail
. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and delete this e-mail. Any...
View Full Message
|
|
|
Ji Dong
|
Re: HAM Manger do not work as I expected
|
Ji Dong
09/17/2009 4:03 AM
post38131
|
Re: HAM Manger do not work as I expected
Not very sure what version it is, and how to get the ham version.
It comes with QNX 6.4.0 DVD package.
and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
I have attached the "ham" binary for your information.
> the ham registers for the procmgr_event when any daemon process dies.
> And then it looks through its list of monitored processes. So it should
> be able to detect the death any process that calls procmgr_daemon also.
>
> ham registers for
>
> procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
>
> the reason I wanted to know the version, was because a PR 65295 was
> fixed which was an issue similar to this.
>
> shiv
> Wed Sep 16 15:10:13 EDT 2009
>
>
|
Attachment: |
ham
107.81 KB
|
|
|
Shiv Nagarajan(deleted)
|
Re: HAM Manger do not work as I expected
|
Shiv Nagarajan(deleted)
09/17/2009 12:11 PM
post38186
|
Re: HAM Manger do not work as I expected
This appears to have been built
DESCRIPTION=High Availability Manager
DATE=2008/10/21-00:21:48-EDT
STATE=Stable
HOST=trunkbuild
USER=builder
VERSION=6.4.0
since that other PR I was mentioning was fixed feb 2009, in all
likelihood, the bug exists in your version. Let me try and get you a ppc
binary from the latest source for you to try.
thanks
shiv
On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
> Not very sure what version it is, and how to get the ham version.
> It comes with QNX 6.4.0 DVD package.
> and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
>
> I have attached the "ham" binary for your information.
>
>
>
>
> > the ham registers for the procmgr_event when any daemon process
> dies.
> > And then it looks through its list of monitored processes. So it
> should
> > be able to detect the death any process that calls procmgr_daemon
> also.
> >
> > ham registers for
> >
> > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
> >
> > the reason I wanted to know the version, was because a PR 65295 was
> > fixed which was an issue similar to this.
> >
> > shiv
> > Wed Sep 16 15:10:13 EDT 2009
> >
> >
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post38131
>
>
--
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
E-mail: shiv@qnx.com
****
|
|
|
Ji Dong
|
Re: HAM Manger do not work as I expected
|
Ji Dong
09/18/2009 4:02 AM
post38248
|
Re: HAM Manger do not work as I expected
> This appears to have been built
>
> DESCRIPTION=High Availability Manager
> DATE=2008/10/21-00:21:48-EDT
> STATE=Stable
> HOST=trunkbuild
> USER=builder
> VERSION=6.4.0
>
> since that other PR I was mentioning was fixed feb 2009, in all
> likelihood, the bug exists in your version. Let me try and get you a ppc
> binary from the latest source for you to try.
>
> thanks
> shiv
>
> On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
> > Not very sure what version it is, and how to get the ham version.
> > It comes with QNX 6.4.0 DVD package.
> > and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
> >
> > I have attached the "ham" binary for your information.
> >
> >
> >
> >
> > > the ham registers for the procmgr_event when any daemon process
> > dies.
> > > And then it looks through its list of monitored processes. So it
> > should
> > > be able to detect the death any process that calls procmgr_daemon
> > also.
> > >
> > > ham registers for
> > >
> > > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
> > >
> > > the reason I wanted to know the version, was because a PR 65295 was
> > > fixed which was an issue similar to this.
> > >
> > > shiv
> > > Wed Sep 16 15:10:13 EDT 2009
> > >
> > >
> >
> >
> >
> > _______________________________________________
> >
> > OSTech
> > http://community.qnx.com/sf/go/post38131
> >
> >
> --
> ****
> Shiv Nagarajan,
> Kernel Developer, QNX Software Systems,
> Ottawa, Canada
> E-mail: shiv@qnx.com
> ****
Thanks shiv
I am expecting your new Binary:)
|
|
|
Shiv Nagarajan(deleted)
|
Re: HAM Manger do not work as I expected
|
Shiv Nagarajan(deleted)
09/18/2009 10:49 AM
post38303
|
Re: HAM Manger do not work as I expected
Attached is the ham from 6.4.1 for ppc.
do let me know if this works better.
thanks
shiv
Fri Sep 18 10:52:50 EDT 2009
--> According to Ji Dong <--
> This appears to have been built
>
> DESCRIPTION=High Availability Manager
> DATE=2008/10/21-00:21:48-EDT
> STATE=Stable
> HOST=trunkbuild
> USER=builder
> VERSION=6.4.0
>
> since that other PR I was mentioning was fixed feb 2009, in all
> likelihood, the bug exists in your version. Let me try and get you a
ppc
> binary from the latest source for you to try.
>
> thanks
> shiv
>
> On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
> > Not very sure what version it is, and how to get the ham version.
> > It comes with QNX 6.4.0 DVD package.
> > and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
> >
> > I have attached the "ham" binary for your information.
> >
> >
> >
> >
> > > the ham registers for the procmgr_event when any daemon process
> > dies.
> > > And then it looks through its list of monitored processes. So it
> > should
> > > be able to detect the death any process that calls procmgr_daemon
> > also.
> > >
> > > ham registers for
> > >
> > > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
> > >
> > > the reason I wanted to know the version, was because a PR 65295
was
> > > fixed which was an issue similar to this.
> > >
> > > shiv
> > > Wed Sep 16 15:10:13 EDT 2009
> > >
> > >
> >
> >
> >
> > _______________________________________________
> >
> > OSTech
> > http://community.qnx.com/sf/go/post38131
> >
> >
> --
> ****
> Shiv Nagarajan,
> Kernel Developer, QNX Software Systems,
> Ottawa, Canada
> E-mail: shiv@qnx.com
> ****
Thanks shiv
I am expecting your new Binary:)
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post38248
--
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
|
Attachment: |
ham
100.01 KB
|
|
|
Ji Dong
|
Re: HAM Manger do not work as I expected
|
Ji Dong
09/24/2009 3:42 AM
post38615
|
Re: HAM Manger do not work as I expected
Hi shiv:
Thanks for your help, the binary works perfect.....
> Attached is the ham from 6.4.1 for ppc.
> do let me know if this works better.
>
> thanks
> shiv
|
|
|
Ji Dong
|
Re: AW: HAM Manger do not work as I expected
|
Ji Dong
09/17/2009 4:14 AM
post38133
|
Re: AW: HAM Manger do not work as I expected
Hi Hans-Peter Reichert:
Initially I have not call procmgr_daemon(), it is the same. and I have search around and not quite understand something
like, it have to run on "session 1" so have to use procmgr_daemon() instead of daemon(), so I just give a try, and this
do not really help.
Because currently all our software is single thread, and have not actually spawn any child process, not sure what harm
will cause if I use procmgr_daemon() to run the process in the backgrand.
Cheers
Ji
> is HAM capable of detecting the change of process' state from a regular child
> to a detached daemon?
>
> when you start the process first, it's a child and you detect starvation
> through a normal SIGCHLD,
> but when the process is doing the procmgr_daemon()
> you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
> as I can't find any special constants for a daemon in ham_condition()
> I am asking how ham would detect whether it's a daemon or a child?
>
> BTW: what happens when you just skip that procmgr_daemon() call?
>
> /hp
|
|
|
|