Open PGcritter opened 1 year ago
I added a workaround.. not really a proper solution for the problem, but it will prevent deadbeef's crash detector from triggering after computer reboots etc. Also, it works only with GTK3.
Hello Oleksiy, thanks for working on this but i just tried the latest static dev build and the problem does not appear to be fixed for me ? Neither when killing deadbeef from the command line nor when exiting my (plasma) session...
Killing deadbeef from command line is basically the same thing as forcing deadbeef to crash (also known as "force-close"). It is expected to detect this as a crash, and suppress the resume functionality.
I haven't tested with plasma though, only with GNOME, I don't know whether GTK can handle plasma session shutdown, but I'll try it out.
Yes, I can confirm that the workaround that I added is not compatible with KDE. Sorry. I don't know how to make this work, but I'll keep the issue open.
Meanwhile i have tested under XFCE (4.18) where your fix is working ! I suppose it makes sense that a GTK3-specific API (or convention) might not work under qt/kde ... TBH i am very happy with db 1.8.8 but in the long run it'd be annoying to be stuck with an older revision. Thanks again.
I have added a SIGTERM handler, which is supposed to perform a quicksave and reset the crash marker. It's not guaranteed to work in all situations, since X11 vs GTK communication during shutdown is not great, but I think it might work in some situations.
actually I tested it with KDE, and unfortunately it didn't work at all. Seems like the application gets killed before it has a chance to perform any cleanup.
Unfortunately the new fix doesn't work with either KDE or GNOME.. so I'll have to remove it, since it doesn't make any sense.
I'm "downgrading" this issue to "Enhancement", since this issue is not really a bug, but more a lack of X11 session management integration (if such thing exists at all, which I'm not sure about).
Fine with me. On XFCE, deadbeef 1.9.5 definitely shows the crash notification when restarted after a session termination stopped the program. So your fix seems to improve things at least under GTK3-based environments.
a workaround that I use and works on every desktop I have tried is to delete the (lock file) aka (running) prior to loading
eg. i add this to $HOME/.fluxbox/startup
in fluxbox I add this to the startup script rm ~/.config/deadbeef/running && deadbeef &
hey, thanks for the tip ! I added this as a KDE autostart script (took me a while as the documentation is outdated; as of plasma 5.20 it belongs in ~/.config/plasma-workspace/env/) and it seems to work fine (i tried a couple logoff/logon iterations with no problem) sort of defeats the crash detection i suppose but i am on 1.9.5 now, thanks again !
no problem on the kde neon 5.27.7 i have just created a bash script and put it in the autostart
program: bash arguments: /path/script.sh
as for "defeats the crash detection i suppose" -- I disagree. since deadbeef still gives a crash report if it crashes during the session.. so the only way it doesn't work is if the whole system crashes. in which case it's not deadbeefs problem anyway
in my opinion it's an uncleaned lock file ... putting it in /tmp would likely solve the problem for all boots .. assuming /tmp is cleaned at boot, as for log out and back in deadbeef could call ps -e | grep X and if X time is below a value then no crash report... that would also work for a reboot so the /tmp option would no longer be necessary
anyway glad it works
It is not an uncleaned lock file. It's specifically made to detect the crashes / unclean terminations. It cleans only if the application is terminated cleanly.
The problem is that with X session management vs GTK applications it's a really difficult thing to achieve, since killing X server would trigger a handler in GTK which terminates the application process without giving it any chance to clean up.
The proper fix is to receive a proper termination signal from the desktop environment / X session manager. However I'm yet to find a working example code that would work. Nothing I tried worked so far.
"without giving it any chance to clean up". lol :) anyway it sounds like it does recieve a SIGHUP? or something of sort
The process gets terminated by calling exit in a GTK SIGTERM handler when it detects that X server is down. This occurs regardless of whether the app installs its own SIGTERM handler, the process would be killed before this handler is executed.
edit: sorry, I remembered that what I wrote is not entirely correct. This is the correct sequence of events:
At the very least it should follow convention and handle SIGTERM, whether or not it gets enough time to clean up isn't in your control. It should call the same thing that sending --quit does now.
@putmeinatoaster would you mind if I ask you to provide a link to the convention you're referring to? Never heard of one, so I would not know where to look.
Oh sorry, in english when we say "convention" it does not mean hard and fast rule. It means more like a commonly agreed upon way to handle things. Like a crash detection system shouldn't leave files behind when the user asks polity for the program to exit cleanly (SIGTERM).
Did you even read the other comments in this issue? It's not like I haven't tried to do what you suggest. It doesn't work. And it doesn't work specifically in the case of GTK applications on Linux. If you think you know better, and it's supposed to work -- feel free to implement it, test it, and submit a patch.
This is a diff on main.c sig.txt I have literally never edited a c file before nor do I know how to make pull requests... or how to format github comments. :P It's practically copy pasta from the first google hit when you search "sigterm c example" I will run this for a while but I don't get around with desktop environments to test. I really don't think i know better. I'm sure it breaks something.
I'm sure it breaks something.
I'm sure about this too. This would not work at all.
not at all? I mean im using it now and can send SIGTERM and then restart the player with the 'save_resume_state' having finished and cleared its 'running' file. So far the only bit that seemed odd was that i had to redo my playlists...
You haven't tried ending X session and then looking what happens, did you?
No that will never work. If X crashes then nothing to be done there. Handling SIGTERM specifically is all I wanted.
I'm not talking about crashing X. I'm talking about quitting X session cleanly.
(which is what this specific bug is about)
Oh. Then that depends on your setup. For example KDE sends SIGTERM and waits a bit before closing. I do pretty much the same with a shutdown script. No idea about gnome of xfce.
Oh. Then that depends on your setup. For example KDE sends SIGTERM and waits a bit before closing. I do pretty much the same with a shutdown script. No idea about gnome of xfce.
Yes, they wait enough. But remember that X is just another process, which gets SIGTERM signal just the same. If it finishes terminating before other processes (such as deadbeef) get a SIGTERM -- GTK will terminate the process, and SIGTERM will not be handled. This is pretty much the whole story about this bug and why it's open.
I don't know what usecase you're trying to solve, but your patch would not solve this bug.
Also, your patch will make this bug much more of a problem, since there will be a lot of undefined behavior when deadbeef process is killed while it's running SIGTERM handler. This was the original behavior of deadbeef, which had to be removed because it caused way more problems, than not doing anything at all.
If you're having a hard time finding the information I'm referring to -- please read this comment. It covers it in detail.
Just mine i guess :P I would never put deadbeef in that position. I love her too much!
I posted about this on the deadbeef sourceforge pages here.
Deadbeef version: 1.9.5 (also 1.9.4, 1.9.2) OS: linux MX21 compatible with debian 11 "bullseye")
Every now and then (typically on DE session startup, KDE plasma in my case), deadbeef reports a crash occurred e.g (for v1.9.5 below)
The problem can be reproduced by killing deadbeef from the command line. The next started instance then shows the above message. I have seen this with 1.95 (static+deb), 1.94(static), 1.92(static).
The same problem however, does not occur with deadbeef v1.8.8.
As per our preliminary discussion in the linked thread, this may be caused by some startup loop detection introduced in 1.9.x.
Perhaps one way to remediate this would be to differentiate terminations initiated by a DE from hard crashes (or SIGKILL).