Comments (5)
The symptoms I described might be wrong here... the problem might actually be within the re-registration process rather than the signal catching itself.
from containerpilot.
Ok, got it. We have a deadlock between reloadConfig()
and inMaintenanceMode()
(in signals.go).
When reloadConfig
is hit, it obtains the r/w lock on the signalLock
global. This lock is designed to prevent us from trying to handle more than one signal at a time. The inMaintenanceMode
query is allowed to get a read lock. Multiple readers are allowed at the same time that one writer -- one signal handler, that is -- has a lock. The inMaintenanceMode
query runs in the poll
function (in main.go), which is running a select for ticker events or a send on the quit channel. (This will be important in a second.)
The sequence of events that leads to a deadlock is as follows:
SIGHUP
is receivedreloadConfig
is called- the running goroutine obtains a r/w lock
- we perform IO at
loadConfig
, so we yield execution
- a goroutine running
poll
is scheduled- it hits a select on
ticker.C
and callsinMaintenanceMode
inMaintenanceMode
asks for a read lock and can't obtain one- the polling gorouting blocks, so it yields execution
- it hits a select on
- our main goroutine is scheduled
- it hits
stopPolling
and sends on the quit channel
- it hits
At this point, no polling goroutine can make forward progress because we are waiting on the read lock. And the main goroutine can't make forward progress because it's waiting to send on a synchronous channel to those blocked goroutines.
@justenwalker I think the solution to this is to split the signalLock
from the lock around the paused
global. We can have toggleMaintenanceMode
, terminate
, and reloadConfig
fight over the signalLock
and then have inMaintenanceMode
and toggleMaintenanceMode
fight over a separate maintModeLock
. Because toggleMaintenanceMode
doesn't send to the quit
channels, we don't have the same possibility of a deadlock there.
I'll test this fix out with my application and see if it does the job.
from containerpilot.
Opened #74
from containerpilot.
Merged. Awaiting the 1.0 release.
from containerpilot.
Released in RC: https://github.com/joyent/containerbuddy/releases/tag/0.1.1
from containerpilot.
Related Issues (20)
- Stability issues with signal events under SmartOS/LX HOT 2
- [Question]How to disable default metrics and only response custom defined metrics? HOT 5
- Building inside a docker container HOT 2
- SmartOS and LX brand issues with Go 1.9
- Docs incorrectly say 'initialStatus', should be 'initial_status' HOT 2
- Telemetry custom metrics always zero HOT 4
- Run as user per job HOT 5
- Allow for an ADHoc Sending of a signal to a ContainerPilot job. HOT 1
- Project status HOT 3
- Error parsing environment variable in config template
- Unable to execute job HOT 1
- CP ends up ignoring that it's jobs have been killed
- Local build on SmartOS fails due to upstream changes
- 100% CPU Usage
- github url's in documentation
- Documentation Update: docker-compose --scale "change"
- consul with TLS does not read env vars set by -putenv
- Broken link to blog/wordpress-on-autopilot
- Container Pilot process get hung and cannot recover when health check timeouts continues for more than an hour
- Support consul service meta data HOT 5
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 containerpilot.