Closed jonaseberle closed 4 months ago
Ok. Running wmctrl -c "Little Navconnect 2.9.0.develop"
results in main.cpp:132: app.exec() done, retval is 0 (ok)
.
Sending SIGTERM and even Ctrl+C result in a crash. Meh. Seems Qt does not to any signal handling at all.
The window will not show up in wmctrl -l
it the program is minimized to to the system tray. The main window is simply hidden in this case.
To get rid of the shared memory segment use ipcs
and ipcrm
.
$ ipcs
...
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
...
0x510607d9 1409083 alex 600 64 0
...
There is one segment with 64 bytes size. Delete this one:
ipcrm -m 1409083
. Then Navconnect should start again.
This is a Linux peculiarity. macOS and Windows release the segments once the owner quits.
I plan to catch crashes/signals with backtrace anyway. I can have a look at this when I'm at it.
More: I added a timestamp base mechanism in LNM which detects if the owner of the shm is gone. I can apply this to Navconnect as well but the unfriendly exit is still an issue and should be fixed.
Thank you. Yes, indeed it is set to start minimized.
Stale shared memory
Thanks for teaching me about ipcs
and ipcrm
- that's already a great help.
I can confirm that Little Navmap starts after being SIGTERM
ed.
Graceful shutdown on SIGTERM
Little Navmap skips its shutdown steps like saving the last map position.
It would be best of course if Qt would just call the windows' closeEvent
s when receiving SIGTERM... I just did a quick test with QCoreApplication::aboutToQuit
and even that is not called.
But it is an edge case and my use case is not really strong either ;) In my Qt apps I usually don't implement it either.
You're welcome. I'll add support for signals.
Done in 3.0.2.beta for Navconnect and Navmap
Hi and thank you for the wonderful Little Navmap and its flexibility to run it over the network!
Problem
Little Navconnect reports
Little Navconnect is already running
when it was previously exited via CTRL+C or SIGTERM.My use case
I launch all helper programs with the flight sim in a script. When the sim closes, it closes the helper programs with it.
Usually I send a
SIGTERM
to the program. For Little Navconnect, that seemingly does not gracefully shut down and subsequent launches are stopped when existence of shared memory is checked.I use
wmctrl -c "window title I want to close"
(which closes the main window via the window manager) to shut down Little Navmap which has the same issue. But I cannot use that for Little Navconnect AFAIK because it does not show up in thewmctrl -l
list – it has no open window but just an icon with a menu.I just wanted to let you know. Maybe it would be feasible to handle SIGTERM as a graceful request for shutdown. I believe by POSIX it should be graceful but I know that Qt does not implement it like that for windowed applications.
Manjaro (Arch) Linux, Kernel 6.4.6
abarthel-little_navconnect.log after first launch, exiting via menu entry "QUIT" abarthel-little_navconnect.log after launch that was exited with CTRL+C or SIGTERM abarthel-little_navconnect.log subsequent launches