Comments (6)
@gdb: At least from a monitoring perspective, what do you think about adding a last_upgraded element to einhorn's state? That way you can have a monitoring script that warns if any child isn't the current version once (Time.now - last_upgraded)
is greater than some threshold.
Doesn't solve the underlying problem of getting in this stuck state, but at least gives you an easy way to automatically detect when you should be worried about it.
from einhorn.
Yeah, I like the idea last_upgraded.
I think adding some sort of flapping detection would also be good, though it's unclear to me exactly what the semantics should be and how it should be reported. I guess you could do something along the lines of watching for workers dying pre-ACK and then putting the result in your state. Depends on exactly what we want to defend against, I guess.
from einhorn.
What's the right way for me to get the state in a machine-inspectable way over the control socket? The 'state' command gives me a string from .inspect - am I expected to..eval that or something? (That would sketch me out, but it doesn't matter because it also doesn't seem to work because, e.g., Time objects aren't eval'able)
from einhorn.
I can see a few possible answers:
- Have a separate machine_readable_state command, which returns a JSON dump of the state, or
- Return a YAML dump rather than .inspect for state, or
- Return a JSON dump for state
I think the third one is superior, though it has the disadvantage of not exposing type information (e.g. symbol keys vs string keys) as well as .inspect does. That's mostly useful for debugging, and so maybe there should be an inspect_state command or something.
from einhorn.
Hmm, JSON on its own doesn't seem to be sufficient here. In
particular, Time objects dumped to JSON generate their .inspect
representation, which is still not useful for easy parsing:
[3] pry(main)> JSON.load(JSON.dump(Time.now))
=> "Sun Jun 17 12:53:53 -0700 2012"
YAML.load(YAML.dump(Time.now))
does return a Time object, although
YAML can also do things like serialize arbitrary types, which is a bit
sketch:
[5] pry(main)> puts Set.new.to_yaml
--- !ruby/object:Set
hash: {}
We could pre- and post-process the state dict to coerce timestamps to
seconds-since-epoch and back, but you can't really do that without
encoding details about the keys in the state dict, which I'm not wild
about.
I think I'd lean towards using YAML, and probably hide it under a
separate command. Thoughts?
from einhorn.
I've actually been meaning to get rid of JSON from the Einhorn protocol. It's the only gem dependency. If YAML allows arbitrary code execution, I'd rather not use it. If however it's safe, then we could switch to it.
from einhorn.
Related Issues (20)
- YAML issue with Ruby 3.1 HOT 3
- Integrate standardrb
- Integrate Github actions CI workflow
- [very low priority] The README says "Welcome gdb"
- Maybe make YAML parsing safer
- Crash during upgrade
- License missing from gemspec HOT 3
- how to keep einhorn running in background? HOT 2
- Race condition in einhorn?
- JRuby support HOT 1
- Socket reuse flag not working? HOT 2
- Prints "Could not find any config for exited child..." upon upgrade HOT 4
- Is there a way to "inject" environment variables when upgrading? HOT 1
- When new releases will be available in rubygems.org? HOT 4
- Einhorn with Goliath HOT 1
- Support binding UNIX sockets
- Any plans to publish v0.7.5 to rubygems.org? HOT 2
- Customize graceful shutdown signal
- Is this project abandoned? HOT 1
- `config` command does not work properly
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 einhorn.