Commit Graph

13 Commits

Author SHA1 Message Date
Michael S. Fischer 01ec256c7e lock.go: fix another race condition
The previous fix to `consul lock` (commit 6875e8d) didn't completely
eliminate the race that could occur if the lock was acquired around the
same time SIGTERM was received:  It was still possible for
Run() to spawn the process via startChild() after killChild() had
released the shared mutex.

Now, when SIGTERM is received, we acquire a mutex that prevents
spawning a new process and never release it.

We've tested this fix pretty thoroughly and believe it completely
resolves the issue.
2015-09-01 14:27:23 -07:00
Ryota Arai c45f2971e7 command/lock: Pass stdin to child process when -pass-stdin passed. 2015-08-26 16:27:21 +09:00
Armon Dadgar c2a865686c Merge pull request #1158 from mfischer-zd/fix_1155
lock.go: fix race condition
2015-08-05 14:56:13 -07:00
Michael S. Fischer 9e0e9e389d lock.go: fix race condition
Fix a race condition between startChild() and killChild() that could
lead to an orphaned managed process.

Fixes #1155
2015-08-05 09:06:51 -07:00
J.R. Garcia f95ba4b8eb Remove trailing slash from lock
Lock command will remove trailing slash from path (as it is invalid).
Fixes #1136.
2015-07-30 12:14:17 -05:00
Armon Dadgar 6f42f6640c command/lock: Check for shutdown during lock acquisition. Fixes #800 2015-07-22 16:07:44 -07:00
Benjamin Abbott-Scott eece6e4848 Return every time lock acquisition fails 2015-07-22 10:44:47 -07:00
Emil Hessman 2a80aacb86 docs: describe child process handling on Windows for lock command
Add website documentation for how the lock command handles child
process termination on Windows.
2015-01-25 11:42:29 +01:00
Emil Hessman c8224b3f94 command: fix Windows build
Add a per GOOS implementation to send signals to PIDs
since syscall.Kill does not exist on Windows.

It will always send a SIGKILL on Windows since there
seems to be no POSIX compatible notion.

Fixes build on Windows.
2015-01-25 05:00:52 +01:00
Armon Dadgar 2502398481 command/lock: Fixing mixed spaces and tabs 2015-01-20 12:58:29 -08:00
Armon Dadgar b52c14d1b2 command/lock: Calculate name, use provided token 2015-01-19 15:38:00 -10:00
Armon Dadgar cdfaaac3ac command/lock: Ensure a conflict between lock and semaphore with shared prefix 2015-01-19 15:26:17 -10:00
Armon Dadgar 1aa8b0fc23 command/lock: First pass at lock 2015-01-19 14:37:48 -10:00