ptrace in production systems

ptrace in production systems

Shachar Shemesh shachar at shemesh.biz
Sun Feb 1 17:36:43 IST 2009


I think there are a couple of points that did not come across.

The first is that this is an embedded system. It runs an ARM CPU, has 
32MB of RAM and 4MB of flash. If we pass the 2MB of (somewhat 
compressed) filesystem usage mark, we will be in deep s%^$ when we get 
to the "switching banks" part of the software upgrade.

 From the Monit web site:
> It is a small program and weights in at just over 300kB
That is a HUGE price to pay just to do what I need (15% of my total 
allocated storage).

The second part that did not come across is that there is no problem to 
implement what I need. I already did, and it is working beautifully. My 
question was whether anyone can give a reason why using ptrace in a 
production system is not a good idea, because I have my doubts.

Noam Meltzer wrote:
> Shachar,
>
> What you need is the functionality of a watchdog.
A watchdog is something that periodically monitors a process, and does 
something if the process is not up. This has nothing to do with what I 
need. I need to restart a process. A one time operation of stopping and 
then starting another process.
> HA clusters provide this functionality. Anyhow, I guess you don't 
> have/need an HA cluster, so what you might want to look at is monit: 
> http://mmonit.com/monit/
Like I said, even had monit been what I needed, I cannot afford the 
300KB it takes.
> I understand that you want to monitor it using your own daemon,
No. I do not want to monitor it at all, my daemon or otherise. I want to 
restart it. This is something completely different.
> but I don't believe that you can reinvent the wheel in a reasonable 
> time and effort, so I point you to Monit.
The main loop for a watchdog daemon takes about 20-40 lines of code and 
about two hours to implement. Even had a watchdog been what I needed, I 
doubt sacrificing 15% of my storage for monit would have been worth it.

Shachar



More information about the Linux-il mailing list