indicator-weather refuses to start, saying "Another instance of this program is already running" when that is not true.

Bug #926433 reported by Paul Broadhead
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Weather Indicator
Status tracked in 2.0
2.0
Fix Released
Medium
Unassigned
Baltix
New
Undecided
Unassigned
indicator-weather (Ubuntu)
Fix Released
Medium
Andrew Starr-Bochicchio
Precise
Fix Released
Medium
Unassigned

Bug Description

--- SRU Justification ---

[IMPACT]

When indicator-weather crashes (which is unfortunately fairly often for some users), it sometimes leaves behind a pid file in /tmp. The current pid file checking can sometimes match pids that match part of some other process number. This can cause users to not be able to restart the program after a crash. This fix requires that the pid number matches exactly.

[TESTCASE]

Run indicator-weather and wait for a crash.

Restart indicator-weather.

With the version in precise, it can sometimes not be restarted with this error:

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
Another instance of this program is already running

With the version in precise-proposed, it will always restart.

For extra points, try to start a second instance of indicator-weather. With both versions, this should fail.

[Regression Potential]

Very little. It is a one line change. If there was an issue, it would only display in the same circumstances as this bug, trying to restart after a crash.

---

Description: Ubuntu 11.10
Release: 11.10

indicator-weather:
  Installed: 11.05.31-0ubuntu2.1
  Candidate: 11.05.31-0ubuntu2.1
  Version table:
 *** 11.05.31-0ubuntu2.1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ oneiric-updates/universe amd64 Packages
        100 /var/lib/dpkg/status
     11.05.31-0ubuntu2 0
        500 http://gb.archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages

Expect the indicator to start when run, but it does not but gives the following error message:
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
Another instance of this program is already running

At some stage I assume the indicator crashed and left a file in /tmp called indicator-weather-500.pid. The log file ~/.cache/indicator-weather.log shows extra messages, just that another instances is running. I checked the process list and no instance was running. Once the .pid file had been deleted, the indicator started and ran as normal.

Revision history for this message
Paul Broadhead (pjbroad) wrote :

I've now checked the source code. Unfortunatly, I did not check the contents of the .pid file before deleting it. However, I can see from my directory listing that the length was only 3 characters. Looking at the pid checking code, perhaps the 3 characters matched in part some other process number. I've attached a potential patch to avoid this.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Vadim Rutkovsky (roignac) wrote : Re: indicator-weather leaves .pid file in /tmp and will not restart

Thanks, Paul! Commited this as rev. 305

Changed in indicator-weather (Ubuntu):
status: New → Confirmed
Revision history for this message
Vadim Rutkovsky (roignac) wrote :

This is not actual for 3.0 series, as we use DBus there, so no pids are created

Revision history for this message
Paul Broadhead (pjbroad) wrote :

Vadim. Thanks for commiting the change but you have not used my patch. In fact, I think the change you have made instead breaks the pid detection even more. Please could you have another look at my patch and how you have made the change. My patch uses the "ls -1" to list just the file names, one per line, and the regex "$XX^" (i.e starting and ending) to match exactly files.

Revision history for this message
Vadim Rutkovsky (roignac) wrote :

Yes, you are correct. I hope, I've commited this correctly at rev. 308
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
Paul Broadhead (pjbroad) wrote :

Much better. Thanks for the quick response.

Revision history for this message
Paul Broadhead (pjbroad) wrote :

Looks like this fix didn't make it into precise. Any chance it could be updated?

Revision history for this message
Neal McBurnett (nealmcb) wrote :

I agree that, given how often indicator-weather is crashing (daily for me it seems), this bug will make it hard for a lot of people to even restart the indicator. So please consider releasing this for precise.

In the meantime, people can work around the problem by simply removing the file in /tmp. The file name varies because it has a uid in it. This should work:

$ rm -f /tmp/indicator-weather-$UID.pid

summary: - indicator-weather leaves .pid file in /tmp and will not restart
+ indicator-weather refuses to start, saying "Another instance of this
+ program is already running" when that is not true.
Changed in indicator-weather (Ubuntu Precise):
status: New → Triaged
Changed in indicator-weather (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
Changed in indicator-weather (Ubuntu Precise):
importance: Undecided → Medium
Changed in indicator-weather (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Andrew Starr-Bochicchio (andrewsomething)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-weather - 12.07.30-0ubuntu1

---------------
indicator-weather (12.07.30-0ubuntu1) quantal; urgency=low

  * New upstream release.
   - If Earthtools.org is down, report 'Unknown' rather than
     blocking on sunset and sunrise times (LP: #964365).
   - Correctly preform .pid file matching so we can restart after
     a crash (LP: #926433).
   - Fixed flurries condition being marked as 'Unknown' (LP: #928596).
   - Km in the units tab now written in full as kilometres (LP: #952661).
  * debian/control: Bump standards version to 3.9.3, no changes needed.
  * debian/postinst: Don't manually install or compile gschema. Distutils.Extras
    now installs it correctly and an apt trigger compiles it.
 -- Andrew Starr-Bochicchio <email address hidden> Mon, 30 Jul 2012 16:32:33 -0400

Changed in indicator-weather (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Debdiff for SRU in bug #964365

description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Paul, or anyone else affected,

Accepted indicator-weather into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/indicator-weather/11.11.28-0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in indicator-weather (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Neal McBurnett (nealmcb) wrote :

It seems that this bug has been fixed:

$ killall -i -9 indicator-weather
Signal indicator-weath(2503) ? (y/N) y

$ cat /tmp/indicator-weather-1000.pid
2503

$ indicator-weather
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject

So there is still a complaint, but I think that's another bug.

But the install was not smooth. I got these error messages during the apt-get update:

Setting up indicator-weather (11.11.28-0ubuntu1.1) ...
Installing indicator-specific icons...
Installing indicator dconf schema...
cp: cannot stat `/usr/share/indicator-weather/indicator-weather.gschema.xml': No such file or directory
dpkg: error processing indicator-weather (--configure):
 subprocess installed post-installation script returned error exit status 1

...

Errors were encountered while processing:
 indicator-weather
[master fd875bc] committing changes in /etc after apt run
 Author: neal <neal@rf>
 3 files changed, 3 insertions(+), 3 deletions(-)
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I'm guessing that should be fixed, but don't really know what it is, so I haven't changed the verification-needed tag.

Revision history for this message
Paul Broadhead (pjbroad) wrote :

I have confirmed Neal's experience with the package failing to install, with the same error message. I can't quite work my head around what is happening but if you build a .deb from the new source, the file indicator-weather.gschema.xml is already located in the correct directory and so the copy in debian/postinst fails and is probably not needed.

Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Paul, or anyone else affected,

Accepted indicator-weather into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/indicator-weather/11.11.28-0ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Paul Broadhead (pjbroad) wrote :

The proposed release fixed this bug and installs cleanly.

I tested using this method:

# check the indicator is not running
ps -ef | grep indicator-weather
paul 12866 9323 0 11:32 pts/8 00:00:00 grep indicator-weather

# find a suitable test process PID that does not exist but where the digits are part of an existing process PID
ls /proc | grep 42
1242
2429
8442

# create a false indicator pid file with that pid
echo "42" > /tmp/indicator-weather-$UID.pid

# start the indicator
# with the bug version, the indicator will not start
indicator-weather
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
Another instance of this program is already running

# with the new versions, the indicator starts fine
indicator-weather

# Attempting to start a second instance new version does fails as it should

Paul Broadhead (pjbroad)
tags: added: verification-done
removed: verification-needed
Paul Broadhead (pjbroad)
description: updated
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-weather - 11.11.28-0ubuntu1.2

---------------
indicator-weather (11.11.28-0ubuntu1.2) precise-proposed; urgency=high

  * debian/postinst: Drop manually installation and compilation of gschema
    file. When built against >= 2.32-1, python-distutils-extra automatically
    finds and installs the gschema file leading the postinst script
    to fail as it isn't where it expects it to be (LP: #1032887).

indicator-weather (11.11.28-0ubuntu1.1) precise-proposed; urgency=low

  * debian/patches/dont_block_on_sun_times.patch:
   - If Earthtools.org is down, report 'Unknown' rather than
     blocking on sunset and sunrise times (LP: #964365).
  * debian/patches/fix_flurries.patch:
   - Fixes flurries condition being marked as 'Unknown' (LP: #928596).
  * debian/patches/fix_pid_checking.patch:
   - Correctly preform .pid file matching so we can restart after
     a crash (LP: #926433).
 -- Andrew Starr-Bochicchio <email address hidden> Sat, 04 Aug 2012 10:40:24 -0400

Changed in indicator-weather (Ubuntu Precise):
status: Fix Committed → Fix Released
Joshua Tasker (jtasker)
no longer affects: weather-indicator/3.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

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