bugGNU TeXmacs - Bugs: bug #66840, Plugin process have no time to...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #66840: Plugin process have no time to handle SIGTERM

Submitter:  Jeroen Wouters <jeronim>
Submitted:  Mon 24 Feb 2025 12:08:15 PM UTC
   
 
Category:  Plugins Priority:  5 - Normal
Item Group:  Wishlist Status:  None
Privacy:  Public Assigned to:  lizabelos
Originator Name:  Open/Closed:  Open
Release:  None Release: 
Fixed Release:  None Fixed Release: 
Keywords: 

Mon 10 Mar 2025 08:28:04 PM UTC, comment #2: 

Thanks, I see. In my situation the plugin process starts a child process (Jupyter kernels) that do the actual calculations. I want to stop those before killing the parent, so they don't keep running and consume memory.

I probably can override `(plugin-stop)` in my plugin to make it first send a warning message to the plugin before calling the original plugin-stop to kill it. I have the impression that this is what SIGTERM is meant for, but I'm okay to work around it.

Jeroen Wouters <jeronim>
Group Member
Mon 10 Mar 2025 07:05:43 PM UTC, comment #1: 

The "Interrupt execution" button calls the connection_interrupt function, which sends SIGINT.
The other "Close execution" button terminates the process by calling connection_stop.
If you want to make this default behavior safer for your plugin, then I would suggest customizing the user interface. For instance, you may ask for confirmation before terminating a process.

Grégoire Lecerf <lecerf>
Group Member
Mon 24 Feb 2025 12:08:15 PM UTC, original submission:  

I am trying to catch the shutdown of my plugin process in order to cleanly terminate it.

The documentation says that SIGINT should be sent, but TeXmacs uses `terminate()` from QProcess, which sends SIGTERM. However, `kill()` is immediately called as well, so the plugin process has no time to handle the signal (see `QTMPipeLink::killProcess`).

It seems this can be remedied by adding a non-zero timeout to `killProcess` in `src/Plugins/Qt/qt_pipe_link.cpp`, line 172, for example: `PipeLink.killProcess (1000);`.

I have attached the adaptation of the `minimal` plugin I have used to test this.

Jeroen Wouters <jeronim>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #56946:  minimal.cpp added by jeronim (1KiB - text/x-c++src)
file #56947:  init-minimal.scm added by jeronim (658B - text/x-scheme)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lecerf (Posted a comment)
  • -email is unavailable- added by lizabelos (Updated the item)
  • -email is unavailable- added by jeronim (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-03-10 lecerf Item GroupError Wishlist
    2025-02-24 lizabelos Assigned toNone lizabelos
    2025-02-24 jeronim Attached File- Added minimal.cpp, #56946
        Attached File- Added init-minimal.scm, #56947

    Back to the top

    Powered by Savane 3.14-962f.
    Corresponding source code