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

Added pipe cleanup code

parent ac76bb62
No related branches found
No related tags found
No related merge requests found
...@@ -169,6 +169,7 @@ void * stdin_io_pipe_thread ( void * arg ) ...@@ -169,6 +169,7 @@ void * stdin_io_pipe_thread ( void * arg )
} }
stdin_return: stdin_return:
free_circular_buffer ( cir_buf ) ; free_circular_buffer ( cir_buf ) ;
close ( task_start->pipes[CHILD_IN_WR] ) ;
pthread_exit ( NULL ) ; pthread_exit ( NULL ) ;
} }
...@@ -263,6 +264,7 @@ void * stdout_io_pipe_thread ( void * arg ) ...@@ -263,6 +264,7 @@ void * stdout_io_pipe_thread ( void * arg )
stdout_return: stdout_return:
free_circular_buffer ( cir_buf ) ; free_circular_buffer ( cir_buf ) ;
slurm_close_stream ( task_start->sockets[STDIN_OUT_SOCK] ) ; slurm_close_stream ( task_start->sockets[STDIN_OUT_SOCK] ) ;
close ( task_start->pipes[CHILD_OUT_RD] ) ;
pthread_exit ( NULL ) ; pthread_exit ( NULL ) ;
} }
...@@ -364,6 +366,7 @@ void * stderr_io_pipe_thread ( void * arg ) ...@@ -364,6 +366,7 @@ void * stderr_io_pipe_thread ( void * arg )
stderr_return: stderr_return:
free_circular_buffer ( cir_buf ) ; free_circular_buffer ( cir_buf ) ;
slurm_close_stream ( task_start->sockets[SIG_STDERR_SOCK] ) ; slurm_close_stream ( task_start->sockets[SIG_STDERR_SOCK] ) ;
close ( task_start->pipes[CHILD_ERR_RD] ) ;
pthread_exit ( NULL ) ; pthread_exit ( NULL ) ;
} }
......
...@@ -12,6 +12,13 @@ void setup_parent_pipes ( int * pipes ) ...@@ -12,6 +12,13 @@ void setup_parent_pipes ( int * pipes )
close ( pipes[CHILD_ERR_WR] ) ; close ( pipes[CHILD_ERR_WR] ) ;
} }
void cleanup_parent_pipes ( int * pipes )
{
close ( pipes[CHILD_IN_WR] ) ;
close ( pipes[CHILD_OUT_RD] ) ;
close ( pipes[CHILD_ERR_RD] ) ;
}
int init_parent_pipes ( int * pipes ) int init_parent_pipes ( int * pipes )
{ {
int rc ; int rc ;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
int init_parent_pipes ( int * pipes ) ; int init_parent_pipes ( int * pipes ) ;
void setup_parent_pipes ( int * pipes ) ; void setup_parent_pipes ( int * pipes ) ;
int setup_child_pipes ( int * pipes ) ; int setup_child_pipes ( int * pipes ) ;
void cleanup_parent_pipes ( int * pipes ) ;
#endif #endif
...@@ -134,7 +134,7 @@ int slurmd_init ( ) ...@@ -134,7 +134,7 @@ int slurmd_init ( )
shmem_seg = get_shmem ( ) ; shmem_seg = get_shmem ( ) ;
init_shmem ( shmem_seg ) ; init_shmem ( shmem_seg ) ;
slurm_ssl_init ( ) ; slurm_ssl_init ( ) ;
slurm_init_verifier ( & verify_ctx , "pub_key_file" ) ; slurm_init_verifier ( & verify_ctx , "public.cert" ) ;
initialize_credential_state_list ( & credential_state_list ) ; initialize_credential_state_list ( & credential_state_list ) ;
return SLURM_SUCCESS ; return SLURM_SUCCESS ;
} }
...@@ -241,6 +241,7 @@ int slurmd_msg_engine ( void * args ) ...@@ -241,6 +241,7 @@ int slurmd_msg_engine ( void * args )
service_connection ( ( void * ) conn_arg ) ; service_connection ( ( void * ) conn_arg ) ;
} }
} }
slurm_shutdown_msg_engine ( sockfd ) ;
return 0 ; return 0 ;
} }
......
...@@ -126,7 +126,6 @@ void * task_exec_thread ( void * arg ) ...@@ -126,7 +126,6 @@ void * task_exec_thread ( void * arg )
/* create pipes to read child stdin, stdout, sterr */ /* create pipes to read child stdin, stdout, sterr */
init_parent_pipes ( task_start->pipes ) ; init_parent_pipes ( task_start->pipes ) ;
forward_io ( arg ) ;
#define FORK_ERROR -1 #define FORK_ERROR -1
#define CHILD_PROCCESS 0 #define CHILD_PROCCESS 0
...@@ -191,7 +190,9 @@ void * task_exec_thread ( void * arg ) ...@@ -191,7 +190,9 @@ void * task_exec_thread ( void * arg )
default: /*parent proccess */ default: /*parent proccess */
task_start->exec_pid = cpid ; task_start->exec_pid = cpid ;
setup_parent_pipes ( task_start->pipes ) ; setup_parent_pipes ( task_start->pipes ) ;
forward_io ( arg ) ;
waitpid ( cpid , & task_return_code , 0 ) ; waitpid ( cpid , & task_return_code , 0 ) ;
cleanup_parent_pipes ( task_start->pipes ) ;
send_task_exit_msg ( task_return_code , task_start ) ; send_task_exit_msg ( task_return_code , task_start ) ;
break; break;
} }
......
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