Results 1 to 10 of 10
Hello,
I have a strange problem on RHEL 5.4.
I have created a daemon which is being run as a system service at boot, and the start command goes well. ...
- 03-24-2010 #1Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
[SOLVED] daemon not functioning well before manual restart
Hello,
I have a strange problem on RHEL 5.4.
I have created a daemon which is being run as a system service at boot, and the start command goes well. When I login after boot and check with
service name status
it says it's running and the daemon accepts requests from clients in the network, only the executable it runs as a response to a client request does not work properly.
If I manually restart the service, as with
service name restart
everything works OK until the next system reboot.
Somehow the context in which the daemon runs is not OK after boot, and it becomes OK after manual restart.
Any ideas?
- 03-24-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
The likely answer is that the system context of when the service is started at boot time is not valid. Remember that the client process will inherit that context. So, it may be that you need to change when it starts (after all other services), or put the initial startup in /etc/rc.d/rc.local which is executed after everything else is up.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-25-2010 #3Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
I put
service name restart
in /etc/rc.d/rc.local but that didn't change anything. After boot, again the daemon was not working properly until I did a manual restart.
- 03-26-2010 #4Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
Is there another script that I can restart the service from after boot?
- 03-26-2010 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Rather than playing "Whack-a-Mole" trying to work around this problem, you would be better off spending your time determining the root cause of the instability. Perhaps some description of the services the daemon starts would be in order?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-29-2010 #6Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
Hi,
I did search for the root cause, and it seems that there is a corrupted code in the application that the daemon runs. So, I transfered the issue to the author and I'm waiting for his response.
Thank you, your advice was a good one.
- 04-06-2010 #7Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
It turns out that the application does not have enough stack to run with.
Does anyone know how to increase the stack size that a daemon can use?
Like: ulimit -s unlimited?
I tried /etc/security/limits.conf but that is not used by the daemon so it doesn't affect it.
Can I use /etc/initscript to solve this? I tried using it but I cannot restart the system after that. Luckily, it's a VM so I just snapshot it before I experiment.
- 04-06-2010 #8Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You can set ulimits in a script before running your application, but bear in mind that system limits still apply. If you want to change this inside your application, you can do so with the getrlimit() and setrlimit() functions. See the man page for details.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-07-2010 #9Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
I know, the system limit is my problem. I have set 'unlimited' stack in
/etc/security/limits.conf file, but that does not seem to influence the daemon.
All the users after login have 'unlimited' stack, and that's why the daemon works correctly when I login and restart it manually - it receives the stack setting 'unlimited' from the root user.
- 04-08-2010 #10Just Joined!
- Join Date
- Jul 2004
- Location
- Belgrade
- Posts
- 20
Rubberman,
thank you very much for the tip about setrlimit function.
I used in the application, and the stack gets increased properly and everything works now.
Regards,
D.



