GTG

[patch] a slightly different way to deal with multiple instances

Bug #830135 reported by François Boulogne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTG
Fix Released
Low
François Boulogne

Bug Description

Hi,

When GTG exits, the pidfile (gtg.pid) is not deleted. Looking closer to the code, I saw GTG checked (if pidfile exists which is often the case since gtg.pid is not deleted) if the process is still running or not (via ps command).

I thinks this could be improved easily. First, one can avoid to check running processes in most of the case if the pidfile is deleted when the software stops. This could be done with two lines of codes (see path).

Actually, in the patch, I also suggest a different way to check is the process is still running. Currently, GTG uses the command "ps" to handle that. This is not necessary bacause it is easy to read /proc (this is what ps do, btw)
In the current code, both PID and command are checked. In my patch, I just check the existence of the process (PID). If you think it is worth to analyse the command too, /proc/PID/cmdline could be read to do so.

It does not improve loading time so much, but the code is a bit smarter IMHO.

Revision history for this message
François Boulogne (sciunto.org) wrote :
summary: - [patch] a slightly different way to deals with multiple instances
+ [patch] a slightly different way to deal with multiple instances
Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) wrote :

I agree that this is a small but nice to have improvement

Changed in gtg:
status: New → Confirmed
importance: Undecided → Low
milestone: none → 0.2.9
Revision history for this message
Izidor Matušov (izidor) wrote :

This patch was partially applied as rev. 992.

I prefer using ps command over /proc because it create less dependencies on platform.

Changed in gtg:
status: Confirmed → Fix Committed
assignee: nobody → François (unpeudescience)
Izidor Matušov (izidor)
Changed in gtg:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.