Skip to content
Snippets Groups Projects
Commit d30d7f54 authored by tewk's avatar tewk
Browse files

Fixed deadlock on forked_io threads

parent 16495601
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
int forward_io ( task_start_t * task_start ) int forward_io ( task_start_t * task_start )
{ {
pid_t cpid ; pid_t cpid ;
int * pipes = task_start -> pipes ;
#define FORK_ERROR -1 #define FORK_ERROR -1
...@@ -53,6 +54,11 @@ int forward_io ( task_start_t * task_start ) ...@@ -53,6 +54,11 @@ int forward_io ( task_start_t * task_start )
goto return_label; goto return_label;
break; break;
case 0 : /*CHILD*/ case 0 : /*CHILD*/
close ( pipes[CHILD_IN_RD_PIPE] );
close ( pipes[CHILD_OUT_RD_PIPE] );
close ( pipes[CHILD_OUT_WR_PIPE] );
close ( pipes[CHILD_ERR_RD_PIPE] );
close ( pipes[CHILD_ERR_WR_PIPE] );
stdin_io_pipe_thread ( task_start ) ; stdin_io_pipe_thread ( task_start ) ;
_exit( 0 ) ; _exit( 0 ) ;
break; break;
...@@ -67,6 +73,11 @@ int forward_io ( task_start_t * task_start ) ...@@ -67,6 +73,11 @@ int forward_io ( task_start_t * task_start )
goto kill_stdin_thread; goto kill_stdin_thread;
break; break;
case 0 : /*CHILD*/ case 0 : /*CHILD*/
close ( pipes[CHILD_IN_RD_PIPE] );
close ( pipes[CHILD_IN_WR_PIPE] );
close ( pipes[CHILD_OUT_WR_PIPE] );
close ( pipes[CHILD_ERR_RD_PIPE] );
close ( pipes[CHILD_ERR_WR_PIPE] );
stdout_io_pipe_thread ( task_start ) ; stdout_io_pipe_thread ( task_start ) ;
_exit( 0 ) ; _exit( 0 ) ;
break; break;
...@@ -81,6 +92,11 @@ int forward_io ( task_start_t * task_start ) ...@@ -81,6 +92,11 @@ int forward_io ( task_start_t * task_start )
goto kill_stdout_thread; goto kill_stdout_thread;
break; break;
case 0 : /*CHILD*/ case 0 : /*CHILD*/
close ( pipes[CHILD_IN_RD_PIPE] );
close ( pipes[CHILD_IN_WR_PIPE] );
close ( pipes[CHILD_OUT_RD_PIPE] );
close ( pipes[CHILD_OUT_WR_PIPE] );
close ( pipes[CHILD_ERR_WR_PIPE] );
stderr_io_pipe_thread ( task_start ) ; stderr_io_pipe_thread ( task_start ) ;
_exit( 0 ) ; _exit( 0 ) ;
break; break;
...@@ -91,11 +107,11 @@ int forward_io ( task_start_t * task_start ) ...@@ -91,11 +107,11 @@ int forward_io ( task_start_t * task_start )
goto return_label; goto return_label;
kill_stdout_thread: kill_stdout_thread:
kill ( task_start->io_pthread_id[STDOUT_FILENO] , SIGKILL ); kill ( task_start->io_pthread_id[STDOUT_FILENO] , SIGKILL );
kill_stdin_thread: kill_stdin_thread:
kill ( task_start->io_pthread_id[STDIN_FILENO] , SIGKILL ); kill ( task_start->io_pthread_id[STDIN_FILENO] , SIGKILL );
return_label: return_label:
return SLURM_SUCCESS ; return SLURM_SUCCESS ;
} }
......
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