Bug 484846 - twinkle's lock file behavior is broken - it sometimes thinks it's already running when it's not
Summary: twinkle's lock file behavior is broken - it sometimes thinks it's already run...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: twinkle
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-10 09:55 UTC by Andre Robatino
Modified: 2009-03-16 19:44 UTC (History)
1 user (show)

Fixed In Version: 1.4.2-1.fc10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-16 19:44:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Andre Robatino 2009-02-10 09:55:25 UTC
Description of problem:
Sometimes, when I boot up and then log in, I'll get the following dialog box:

Twinkle is already running.
Lock file /home/andre/.twinkle/twinkle.lck already exists.

Override lock file and start anyway?

Obviously this is wrong.  In fact, it's lying about the reason it thinks twinkle is already running.  It turns out that when I log out, the lock file never gets deleted, so it's always there when I log in.  If that was the reason for the dialog box, I would see it every time, which I don't.  It appears that what's actually happening is that when it sees an existing lock file, it checks whether there exists SOME process with the same PID, and if there is, it just assumes that that process is twinkle, even though it could be anything.  For example, here's what's actually going on on one occasion when I see this dialog box:

[andre@localhost .twinkle]$ cat twinkle.lck
3369[andre@localhost .twinkle]$ ps -A | grep twinkle
 3365 ?        00:00:00 twinkle
[andre@localhost .twinkle]$ ps -A | grep 3369
 3369 ?        00:00:00 gnome-terminal
[andre@localhost .twinkle]$

To be correct, what twinkle needs to do is to check whether the process with the same PID as the lock file is actually a twinkle process before throwing up this warning.

Version-Release number of selected component (if applicable):
twinkle-1.3.2-2.fc10.x86_64

How reproducible:
whenever I see the dialog box

Comment 1 Kevin Fenzi 2009-02-11 18:52:57 UTC
I agree the lock file handling can be improved. I have brought up the issue with upstream. 

However, you shouldn't always be seeing a lock file... twinkle should exit and remove it's lock when it does. How are you logging out? Is this gnome or kde? Or something else?

When you logout, can you login via ssh or a vty and see if twinkle is still running for some reason?

Comment 2 Andre Robatino 2009-02-11 19:50:08 UTC
When I log out of Gnome and then log in on a VT, I see that the twinkle lock file is still there, and twinkle is not running.  On the other hand, if I quit twinkle explicitly by using File/Quit, or if I send twinkle a standard kill signal (15), then twinkle deletes the lock file.

In any case, it's not that important whether twinkle cleans up the lock file or not.  The use of the lock file is just an optimization to speed up startup.  Far more important is correct behavior (not assuming from the existence of the lock file that another copy of twinkle is running, unless it verifies that the lock file PID actually corresponds to another _twinkle_ instance).  The issue of not deleting the lock file shouldn't even be looked at until after the correctness issue is fixed.

Comment 3 Andre Robatino 2009-02-11 20:15:57 UTC
Another reason for not dealing with the lock file cleanup until later is that the broken startup lock file logic only manifests when a lock file is left behind.  If it was cleaned up consistently, then the present bug would only be seen in the rare event that a lock file was left behind due to something like an unclean shutdown, and hence would probably never get fixed.  Please tell upstream to fix the startup logic (this bug, which is an actual bug) first, and the shutdown logic (which is just an optimization failure, not even really a bug) later.

Comment 4 Andre Robatino 2009-02-11 20:31:59 UTC
I should also mention that correctness requires that the startup logic needs to check whether the PID in the lock file corresponds to an instance of twinkle owned _by the same user_.

Comment 5 Kevin Fenzi 2009-02-11 20:45:52 UTC
Well, I agree both issues need to be fixed. 

I don't think you are likely to get too far telling people what bugs they should look at and in what order. I have raised the issue upstream, hopefully they can come up with some fixes, or I can find the time to take a look further. 

Feel free also to chime in on the upstream devel list: 
http://tech.groups.yahoo.com/group/twinklephone/

Comment 6 Andre Robatino 2009-02-11 21:17:08 UTC
I responded on the upstream devel list, but my message hasn't appeared yet.  I indicated that I log out of Gnome in the usual way, by logging out.  It's consistent for me so you should be able to reproduce it.  But I hope the startup bug gets fixed first, since if the lock file gets deleted consistently on clean shutdowns, then it would only exist on unclean shutdowns, so this bug would still exist, but would be much harder to reproduce.

Comment 7 Kevin Fenzi 2009-02-11 21:45:52 UTC
It looks like your reply went to just me. Can you resend to the list?

Comment 8 Andre Robatino 2009-02-11 22:09:28 UTC
I was not previously a member of the twinklephone group, so it's possible that I was not allowed to post to the whole group, even though I have a Yahoo account.  I joined the group and then posted again, verifying that it was posted to the group.  I still don't see the new message, but hopefully it will show up.  In case it doesn't, I expressed a concern about whether unclean shutdowns would prevent the lock file from getting deleted.

Comment 9 Andre Robatino 2009-02-13 18:27:41 UTC
Same behavior in Rawhide with twinkle-1.4.1-1.fc11.x86_64 (although I'm sure Michel de Boer knows that already).  Should this bug be cloned?

Comment 10 Kevin Fenzi 2009-02-13 18:42:37 UTC
No need. It sounds like Michael has a fix upstream that will be in the next release. I will build it for both rawhide and F-10.

Comment 11 Fedora Update System 2009-03-03 06:05:31 UTC
twinkle-1.4.2-1.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/twinkle-1.4.2-1.fc10

Comment 12 Kevin Fenzi 2009-03-03 06:08:43 UTC
Would you care to try the above update? Hopefully it fixes the issue.

Comment 13 Andre Robatino 2009-03-03 06:38:14 UTC
I noticed that you successfully built this for both F10 and rawhide.  I'll start running it on login on both of these, but since the problem only manifested about 5-10% of the time before, it will take a while to be sure if it's fixed.

Comment 14 Kevin Fenzi 2009-03-03 07:02:54 UTC
No problem. Test as you are able. 

I have been running the rawhide version here for a bit, it just wouldn't offically build due to some kde libs issues until today. Let me know if you spot any problems with them.

Comment 15 Andre Robatino 2009-03-04 03:36:08 UTC
Running twinkle-1.4.2-1.fc10.x86_64 on F10, today when I booted up and logged in, I was told that my sound Ring tone device was wrong.  I'm used to having to manually change the sound devices when logging in, though it's usually the Speaker and Microphone devices, not the Ring tone device.  Also, when I look, the Ring tone device  (ALSA: default: Default device) is correct, but the other two are wrong.  Anyway, I make the changes, then try quitting and restarting Twinkle as usual, to make sure the changes stick.  This time they didn't, so I tried fixing the sound devices, quitting and restarting several time without success.  Then I tried logging out and back in, without success.  Finally, after quitting and restarting Twinkle, I got the changes to stick.

I also noticed that there is now a 0-byte lock file in ~/.twinkle which is still not deleted when I log out.  In addition, it's no longer deleted when I explicitly quit Twinkle, either.  Don't know whether this is supposed to be normal behavior.  In the struggle described in the previous paragraph, I might only have succeeded after manually deleting the lock file, but am not sure.

Comment 16 Fedora Update System 2009-03-04 16:28:52 UTC
twinkle-1.4.2-1.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update twinkle'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2346

Comment 17 Kevin Fenzi 2009-03-04 18:18:08 UTC
I think the lock file is no longer used at all. You should be able to delete it yourself or just ignore it. 

Strange on the settings issue. If you see it again, please file a new bug on it. 

Does the locking issue appear fixed at least?

Comment 18 Andre Robatino 2009-03-04 18:35:37 UTC
I haven't seen the lock file error yet, but it hasn't been long enough to tell.  The problem I've experienced is a minor nuisance so I have no objection to this going to updates-released if no one else does.  The lock file reappears after deleting it and restarting twinkle, so it seems to be getting used for something.

I'm guessing that the need to keep resetting the sound devices is due to Alsa devices being named using numbers, as opposed to their real names - as mentioned in

http://alsa.opensrc.org/index.php/MultipleCards

Ekiga doesn't seem to have the problem.  Do you think this is the cause?  If so, I'll file a separate bug for this issue.

Comment 19 Andre Robatino 2009-03-08 17:37:59 UTC
I have not seen the problem described in comment #15 again, or the lock file error, either.  Karma +1

Regarding the sound settings, I posted to the twinklephone list, am still waiting for additional replies.

Comment 20 Kevin Fenzi 2009-03-09 02:35:22 UTC
Excellent. I will leave this open for now, and let it be closed when this update goes into stable in a little bit. 

Yes, I saw your post. Thanks for the report. :)

Comment 21 Fedora Update System 2009-03-16 19:44:30 UTC
twinkle-1.4.2-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.