Skip to content
Snippets Groups Projects
Commit 370e828e authored by Nicolas Joly's avatar Nicolas Joly Committed by Morris Jette
Browse files

Fix scancel(1) uninitialized condition variable

Still testing 16.05 on my NetBSD/amd64 workstation ...
Just encountered a crash with scancel(1).
njoly@lanfeust [~]> sbatch --wrap "sleep 3600"
Submitted batch job 4680
njoly@lanfeust [~]> scancel 4680
scancel: Error detected by libpthread: Invalid condition variable.
Detected by file "/local/src/NetBSD/src/lib/libpthread/pthread_cond.c", line 140, function "pthread_cond_timedwait".
See pthread(3) for information.
zsh: abort (core dumped)  scancel 4680
Checking the code show indeed that pthread_cond_wait() call from scancel.c:_signal_job_by_str() use an uninitialised condition variable "num_active_threads_cond"
The attached patch, which add the missing pthread_cond_init() seems to fix it.
bug 2753
parent d378b297
No related branches found
No related tags found
No related merge requests found
......@@ -911,6 +911,8 @@ static int _signal_job_by_str(void)
if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))
error("pthread_attr_setdetachstate error %m");
slurm_mutex_init(&num_active_threads_lock);
if (pthread_cond_init(&num_active_threads_cond, NULL))
error("pthread_cond_init error %m");
for (i = 0; opt.job_list[i]; i++) {
cancel_info = (job_cancel_info_t *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment