mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.48k stars 1.28k forks source link

Mixxx doesn't gracefully exit when ctrl-c is used on an instance launched from the terminal #12786

Open mxmilkiib opened 8 months ago

mxmilkiib commented 8 months ago

Bug Description

When I run Mixxx from the terminal, and edit hotcues on a track to test, then hit ctrl-c in the terminal, and Mixxx closes, then I start it again; the hotcues are gone.

AFAIU, that use of ctrl-c should make an app exit gracefully, the same as hitting Exit in the File menu, the same as kill -15.

To make an app die in a non graceful way is achieved by using kill -9.

Version

No response

OS

No response

daschuer commented 8 months ago

By default the console sends the SIGINT signal when pressing Ctrl-C. This is meant to immediately interrupt the program when running in a debugger. If you have no debugger, Mixxx cannot continue afterwards and the process is killed. kill -2

I don't know the side effects will be when we catch SIGINT for us, so I would prefer to not do it.

Can you use Alt-F4 instead?

mxmilkiib commented 8 months ago

Whoops, wrong signal, got SIGINT and SIGTERM confused.

GNU libc manual just says SIGINT is what is actioned on a ctrl-c., nothing about the behaviour.

POSIX v4 has fully removed the SIGINT, replaced by SIGACTION with SA_RESTART.

POSIX v1 calls is an "interactive attention signal." and defers regarding behaviour to "UNIX Programming — Second Edition".

"UNIX Programming — Second Edition" says SIGINT can be interpreted in any way, and proceeds to give a number of differing examples, including something that involves a sleep. If it's not caught and used then it doesn't do anything.

Checking around for opinion, what it does certainly varies, though most sources usually say it is interpreted the same as SIGTERM. Some even say it's less of a priority than a SIGTERM in terms of requesting the application to exit.

Re a debugger, I would have thought that kill -9 to the app (not debugger) PID would also incur the same behaviour regarding an instant stop.

I guess in terms of like UX persona, "what is the largest class of person is going to be hitting ctrl-c to close Mixxx after launching it from a terminal? and what does that class of user expect to happen?" is a pertanent question. Who is this serving?

One might argue that that would be users.

Do users generally expect ctrl-c to make an app that's launched from the terminal (GUI or TUI) be killed instantly, or gracefully exit?

I would imaging that it's the latter, but IDRK. Personally, I habitually use ctrl-c to exit apps (and I use it instead of Esc in Vim), and I think most handle that like a Ctrl-Q in the GUI.

One behaviour I've seen about is the first press being a kind request to finish up, and the second press being more of a drop everything now poke.

(Alt-F4 does nothing here, my WM keysym to close a window is meta-q. But I'll often just ctrl-c in the terminal as that's more convenient, and usually get terminal focused because I want to immediatly rerun the app after)

m0dB commented 8 months ago

FWIW I expect ctrl-c to kill the app immediately, and I think that it's the general expectation. After all, it also is the default behavior. That said, I agree that the possible data loss (be it through killing the application or through abnormal termination in general) is very unfortunate. I have no idea how hard it would be to write changes to disk more often but the fact it is the way it is makes me suspect it's not trivial.