Git Product home page Git Product logo

Comments (4)

comrumino avatar comrumino commented on July 28, 2024 1

The reason the above method does not work is that the signal is being absorbed by the thread running the connection to your client (my best guess without testing/breakpoints/debugging myself). Each client will result in their own thread spawn when using ThreadedServer. From a system administration standpoint, it would make more sense to terminate the process using whatever starts your server — if you are using something like systemd it would potentially restart the service if you try doing it this way.

If you want a pure RPyC solution, I would say you would probably want to inherit the threaded server and extend it to do one of the following:

  1. intercept the shutdown request
  2. add support for propagating signals from your thread
  3. Try calling os.exit or sys.exit, but this is dirty and wouldn't exit cleanly.

As for where to ask questions, here is okay. I respond on best effort.

from rpyc.

glyh avatar glyh commented on July 28, 2024

Looks like I need to patch _accept_method, and that is fairly complicated to do, I guess I'll probably stick to kill to just kill the process.

from rpyc.

glyh avatar glyh commented on July 28, 2024

I'll take a look once I have time. In my case the server is a forked subprocess of the client, and the Cilent is a textual TUI app.

from rpyc.

comrumino avatar comrumino commented on July 28, 2024

@glyh , iirc, when I did this for an electron desktop in the past, rather than forking the process, try keep the the server as a child process and sending the signal from the client/TUI-app. Of course, there needs to be signal handling for the RPyC server process — if I have time, I will check the docs for an example or try to write one this weekend.

From what I remember, RPyC does not document how to do this very well. There is certainly room for enhancement of RPyC regarding signal handling and related documentation (i.e., the ThreadedServer has many "gotchas" for signal handling).

from rpyc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.