GithubHelp home page GithubHelp logo

Comments (8)

jnicklas avatar jnicklas commented on July 3, 2024

This turns out to be even more insidious. We need to handle closing the waker socket as well.

from celluloid-zmq.

jnicklas avatar jnicklas commented on July 3, 2024

Turns out, fixing the waker issue was trivial. Also sent celluloid/celluloid#376, which is related.

from celluloid-zmq.

jnicklas avatar jnicklas commented on July 3, 2024

It turns out that this is especially problematic if we forcefully kill an actor, since finalizers might not be run, it seems. I added a global registry for sockets in jnicklas/celluloid-jeromq in this commit, because I couldn't get the test suite to even run reliably otherwise.

Even with this change added, I think that people should definitely add finalizers to close sockets to their actors. This is just a last line of defence.

So my suggestion for fixing this issue in other words is to do both (1) and (2) ;). If you agree, I'll port the change from celluloid-jeromq, and I'll update the documentation.

from celluloid-zmq.

tarcieri avatar tarcieri commented on July 3, 2024

@jnicklas you need finalizers to close open sockets. That's the only option

from celluloid-zmq.

jnicklas avatar jnicklas commented on July 3, 2024

@tarcieri I agree. The registry I added in celluloid-jeromq isn't meant as a replacement for closing sockets in finalizers, it's meant as a last line of defence in case the actor thread is forcefully killed via Actor.kill, because this will cause terminate to hang indefinitely, and the app won't exit cleanly.

from celluloid-zmq.

jnicklas avatar jnicklas commented on July 3, 2024

On the other hand, maybe in that case it's warranted that the process needs to be kill -9'd, I'm not sure.

from celluloid-zmq.

tarcieri avatar tarcieri commented on July 3, 2024

in the kill -9 case it doesn't matter

from celluloid-zmq.

jnicklas avatar jnicklas commented on July 3, 2024

I don't follow. I know it doesn't matter when the app is kill -9'd, and for the majority of apps, it won't even matter if we don't terminate cleanly, but it does matter for some apps. For example JRuby applications where the JVM survives the lifetime of the Ruby VM (think TorqueBox).

So we either never call zmq_term or we better make sure that we don't have any sockets still lying around, because in that case, we have to kill -9 the app, because there is no other way it'll exit.

Not calling zmq_term works fine for most apps, and since celluloid-zmq doesn't have an at_exit hook, I imagine that most people don't. But if we do want to call at_exit, we're going to run into this problem.

from celluloid-zmq.

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.