Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
434e4691
Commit
434e4691
authored
22 years ago
by
tewk
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the imfamous forward_io bug
parent
94990b9f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/slurmd/io.c
+16
-10
16 additions, 10 deletions
src/slurmd/io.c
src/slurmd/pipes.c
+8
-0
8 additions, 0 deletions
src/slurmd/pipes.c
src/slurmd/task_mgr.c
+2
-1
2 additions, 1 deletion
src/slurmd/task_mgr.c
with
26 additions
and
11 deletions
src/slurmd/io.c
+
16
−
10
View file @
434e4691
...
@@ -44,7 +44,7 @@ int forward_io ( task_start_t * task_start )
...
@@ -44,7 +44,7 @@ int forward_io ( task_start_t * task_start )
#define STDIN_OUT_SOCK 0
#define STDIN_OUT_SOCK 0
#define SIG_STDERR_SOCK 1
#define SIG_STDERR_SOCK 1
posix_signal_pipe_ignore
(
)
;
//
posix_signal_pipe_ignore ( ) ;
/* open stdout*/
/* open stdout*/
connect_io_stream
(
task_start
,
STDIN_OUT_SOCK
)
;
connect_io_stream
(
task_start
,
STDIN_OUT_SOCK
)
;
...
@@ -62,16 +62,7 @@ int forward_io ( task_start_t * task_start )
...
@@ -62,16 +62,7 @@ int forward_io ( task_start_t * task_start )
if
(
pthread_create
(
&
task_start
->
io_pthread_id
[
STDERR_FILENO
]
,
NULL
,
stderr_io_pipe_thread
,
task_start
)
)
if
(
pthread_create
(
&
task_start
->
io_pthread_id
[
STDERR_FILENO
]
,
NULL
,
stderr_io_pipe_thread
,
task_start
)
)
goto
kill_stdout_thread
;
goto
kill_stdout_thread
;
/* threads have been detatched*/
pthread_join
(
task_start
->
io_pthread_id
[
STDERR_FILENO
]
,
NULL
)
;
info
(
"errexit"
)
;
pthread_join
(
task_start
->
io_pthread_id
[
STDOUT_FILENO
]
,
NULL
)
;
info
(
"outexit"
)
;
/*pthread_join ( task_start->io_pthread_id[STDIN_FILENO] , NULL ) ;*/
pthread_cancel
(
task_start
->
io_pthread_id
[
STDIN_FILENO
]
);
info
(
"inexit"
)
;
/* thread join on stderr or stdout signifies task termination we should kill the stdin thread */
goto
return_label
;
goto
return_label
;
...
@@ -83,6 +74,19 @@ int forward_io ( task_start_t * task_start )
...
@@ -83,6 +74,19 @@ int forward_io ( task_start_t * task_start )
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
int
wait_on_io_threads
(
task_start_t
*
task_start
)
{
/* threads have been detatched*/
pthread_join
(
task_start
->
io_pthread_id
[
STDERR_FILENO
]
,
NULL
)
;
info
(
"errexit"
)
;
pthread_join
(
task_start
->
io_pthread_id
[
STDOUT_FILENO
]
,
NULL
)
;
info
(
"outexit"
)
;
/*pthread_join ( task_start->io_pthread_id[STDIN_FILENO] , NULL ) ;*/
pthread_cancel
(
task_start
->
io_pthread_id
[
STDIN_FILENO
]
);
info
(
"inexit"
)
;
/* thread join on stderr or stdout signifies task termination we should kill the stdin thread */
}
void
*
stdin_io_pipe_thread
(
void
*
arg
)
void
*
stdin_io_pipe_thread
(
void
*
arg
)
{
{
task_start_t
*
task_start
=
(
task_start_t
*
)
arg
;
task_start_t
*
task_start
=
(
task_start_t
*
)
arg
;
...
@@ -280,6 +284,8 @@ void * stderr_io_pipe_thread ( void * arg )
...
@@ -280,6 +284,8 @@ void * stderr_io_pipe_thread ( void * arg )
init_circular_buffer
(
&
cir_buf
)
;
init_circular_buffer
(
&
cir_buf
)
;
posix_signal_pipe_ignore
(
)
;
while
(
true
)
while
(
true
)
{
{
if
(
(
cir_buf
->
write_size
==
0
)
)
if
(
(
cir_buf
->
write_size
==
0
)
)
...
...
This diff is collapsed.
Click to expand it.
src/slurmd/pipes.c
+
8
−
0
View file @
434e4691
...
@@ -14,9 +14,17 @@ void setup_parent_pipes ( int * pipes )
...
@@ -14,9 +14,17 @@ void setup_parent_pipes ( int * pipes )
void
cleanup_parent_pipes
(
int
*
pipes
)
void
cleanup_parent_pipes
(
int
*
pipes
)
{
{
/*
close ( pipes[CHILD_IN_RD] ) ;
close ( pipes[CHILD_OUT_WR] ) ;
close ( pipes[CHILD_ERR_WR] ) ;
*/
// info ( " %i , %i , %i ", pipes[CHILD_IN_RD] , pipes[CHILD_OUT_WR] , pipes[CHILD_ERR_WR] ) ;
close
(
pipes
[
CHILD_IN_WR
]
)
;
close
(
pipes
[
CHILD_IN_WR
]
)
;
close
(
pipes
[
CHILD_OUT_RD
]
)
;
close
(
pipes
[
CHILD_OUT_RD
]
)
;
close
(
pipes
[
CHILD_ERR_RD
]
)
;
close
(
pipes
[
CHILD_ERR_RD
]
)
;
// info ( " %i , %i , %i ", pipes[CHILD_IN_WR] , pipes[CHILD_OUT_RD] , pipes[CHILD_ERR_RD] ) ;
}
}
int
init_parent_pipes
(
int
*
pipes
)
int
init_parent_pipes
(
int
*
pipes
)
...
...
This diff is collapsed.
Click to expand it.
src/slurmd/task_mgr.c
+
2
−
1
View file @
434e4691
...
@@ -126,6 +126,7 @@ void * task_exec_thread ( void * arg )
...
@@ -126,6 +126,7 @@ 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
...
@@ -190,8 +191,8 @@ void * task_exec_thread ( void * arg )
...
@@ -190,8 +191,8 @@ 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
)
;
wait_on_io_threads
(
task_start
)
;
cleanup_parent_pipes
(
task_start
->
pipes
)
;
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment