wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
471 stars 98 forks source link

SBCL.exe sometimes is not stopped when WxMaxima is closed. #1824

Open richardgobeli opened 11 months ago

richardgobeli commented 11 months ago

When I try to uninstall to load a new version, I notice that the installation stops because SBCL.exe is still running. This makes it so the uninstall does not complete.

Do you know why sometimes in Windows the app SBCL does not stop when WxMaxima is stopped?

I think this happens even when WxMaxima had a normal stop.

This has been happening the last month I think for the different versions with issues in the graphics.

gunterkoenigsmann commented 11 months ago

The problem is that I don't know any way in MS Windows for an application to forcefully kill all subprocesses it has created. I can ask Maxima kindly to exit. But sometimes that doesn't work...

daute commented 11 months ago

taskkill (with the option /T (kill child processes, as maxima is a batch file)) or wxKill (maybe on Windows with wxSIGKILL as mentioned in the wxWidgets docu) should do this: https://docs.wxwidgets.org/3.0/group__group__funcmacro__procctrl.html https://ss64.com/nt/taskkill.html

But where is the maxima process killed? I do not find a call to wxKill() anywhere in the source

gunterkoenigsmann commented 11 months ago

In wxMaxima::KillMaxima I use wxSigKill...

gunterkoenigsmann commented 11 months ago

I've added a call to wxKill, but my suspicion is that the main problem might be that maxima is a child of cmd.exe, not of wxMaxima

gunterkoenigsmann commented 11 months ago

In theory when killing Maxima we close its stdin and stdout, which should kill Maxima, anyway. But perhaps Maxima doesn't always listen to that event....

richardgobeli commented 11 months ago

Is it Maxima or not? I need to kill SBCL.exe.

gunterkoenigsmann commented 11 months ago

The problem is that Maxima is officially started using maxima.bat that then starts clisp.exe, maxima.exe, gcl.exe or sbcl.exe. Maxima at startup tells us which process ID that program has, but MS Windows won't let wxMaxima to send a kill signal to that program.

Maxima should exit, anyway, when there no more is a process that owns its stdin or stdown stream, anyway. Bit seems that might fail, too. Wolfgang now has sent two commits that tell wxWidgets to try harder to kill Maxima, when it tries to