Bug 1177 - Prevent double startup
Status:
RESOLVED FIXED
Component:
Core
Version:
unspecified
Hardware:
All All
Importance:
P5 normal
Target Milestone:
---
Assignee:
Rob Caelers
URL:
http://bugs.debian.org/767739
Depends on:
Blocks:
Reported:
Nov 2 2014 22:15:17 UTC
by:
Francois Marier
Modified:
Dec 23 2015 20:14:47 UTC
CC List:
Matijs van Zuijlen
WhoWhenWhatRemovedAdded
Matijs van ZuijlenDec 24 2014 06:33:01 UTCccMatijs van Zuijlen
Rob CaelersDec 23 2015 20:14:47 UTCstatusNEWRESOLVED
resolutionFIXED
Description
Francois Marier  Nov 2 2014 22:15:17 UTC
Matijs van Zuijlen <ma**@ma**.net> suggested the following on the Debian bug tracker:

"Somehow, Gnome regularly decides to start two copies of workrave. While
we're waiting for Gnome session management to become awesome, it would
be nice if workrave would detect this and start only once."
Comment 1
Rob Caelers  Dec 23 2014 16:19:47 UTC
Workrave uses dbus to check for multiple instances. If workrave cannot become owner of the "org.workrave.Workrave" serbice, it exits. 

Is Workrave actually running twice? I recently fixed a bug where the timers were visible twice in the panel. Is this gnome shell? gnome 3 flashback?
Comment 2
Matijs van Zuijlen  Dec 24 2014 06:33:01 UTC
Yes, workrave is really running twice. I did some testing and can get two running instances as follows (starting from no running instances):

[matijs@walnut] workrave & ; workrave &                                                                                                                                    [1] 29752
[2] 29753
[matijs@walnut] ps -Af | grep workrave                                                                                                                                     matijs   29752 27074  6 07:23 pts/0    00:00:00 workrave
matijs   29753 27074  5 07:23 pts/0    00:00:00 workrave
matijs   29765 27074  0 07:23 pts/0    00:00:00 grep workrave

This results in two of the little monitor windows, and I also get two 'Time for a ... break' windows every time.

This is running under Gnome shell.

Perhaps there's a race condition in getting the dbus service ownership? It seems reasonable to think this is what happens at startup, since Gnome will run the startup programs in quick succession.
Comment 3
Rob Caelers  Dec 23 2015 20:14:47 UTC
I improved the check for multiple copies of Workrave.

It's not perfect: The way to go would be to use the Gtk::Application classes from gtkmm 3, but Windows is still running Gtk+2.