Comments (8)
This turns out to be even more insidious. We need to handle closing the waker socket as well.
from celluloid-zmq.
Turns out, fixing the waker issue was trivial. Also sent celluloid/celluloid#376, which is related.
from celluloid-zmq.
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.
@jnicklas you need finalizers to close open sockets. That's the only option
from celluloid-zmq.
@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.
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.
in the kill -9
case it doesn't matter
from celluloid-zmq.
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)
- The libzmq version 2.0.7 is incompatible with ffi-rzmq HOT 3
- No License.txt HOT 1
- exclamation mark HOT 2
- PubSocket : writing to a specific topic HOT 2
- require of celluloid-io is no longer needed. HOT 1
- Class hierarchy deeper than one level breaks on 0.14.0 HOT 6
- No specs? HOT 1
- Support jeromq, jrzmq? HOT 3
- zmq_proxy / ZMQ::Poll in Actor HOT 9
- Authentication and Encryption HOT 6
- Internal reactor lock on high message pressure in router-dealer pair HOT 2
- release 0.17 HOT 15
- Multi-process example. HOT 1
- Assertion failed: check () (src/msg.cpp:248) HOT 7
- Port to rbczmq HOT 53
- Test suite broken HOT 1
- Function 'zlistx_head' not found HOT 3
- `rake spec` throw exceptions
- How thread safety is handle by Celluloid-ZMQ with ffi-rzmq HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celluloid-zmq.