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
0300bdac
Commit
0300bdac
authored
22 years ago
by
tewk
Browse files
Options
Downloads
Patches
Plain Diff
Fixed SIGPIPE error by ignoring the signal and returning an error_code
parent
0a20952e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/slurm_protocol_errno.h
+1
-0
1 addition, 0 deletions
src/common/slurm_protocol_errno.h
src/common/slurm_protocol_socket_implementation.c
+24
-7
24 additions, 7 deletions
src/common/slurm_protocol_socket_implementation.c
with
25 additions
and
7 deletions
src/common/slurm_protocol_errno.h
+
1
−
0
View file @
0300bdac
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#define SLURM_PROTOCOL_VERSION_ERROR -100
#define SLURM_PROTOCOL_VERSION_ERROR -100
#define SLURM_SOCKET_ERROR -1
#define SLURM_SOCKET_ERROR -1
#define SLURM_PROTOCOL_SUCCESS 0
#define SLURM_PROTOCOL_SUCCESS 0
#define SLURM_PROTOCOL_ERROR -1
#define SLURM_PROTOCOL_FAILURE -1
#define SLURM_PROTOCOL_FAILURE -1
/* general return codes */
/* general return codes */
...
...
This diff is collapsed.
Click to expand it.
src/common/slurm_protocol_socket_implementation.c
+
24
−
7
View file @
0300bdac
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<netinet/in.h>
#include
<netinet/in.h>
#include
<sys/time.h>
#include
<sys/time.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<signal.h>
#if HAVE_SYS_SOCKET_H
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
# include <sys/socket.h>
...
@@ -52,24 +53,35 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin
...
@@ -52,24 +53,35 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin
char
size_buffer_temp
[
8
]
;
char
size_buffer_temp
[
8
]
;
char
*
size_buffer
=
size_buffer_temp
;
char
*
size_buffer
=
size_buffer_temp
;
char
*
moving_buffer
=
buffer
;
char
*
moving_buffer
=
NULL
;
unsigned
int
size_buffer_len
=
8
;
unsigned
int
size_buffer_len
=
8
;
unsigned
int
transmit_size
;
unsigned
int
transmit_size
;
unsigned
int
total_len
;
unsigned
int
total_len
;
if
(
(
recv_len
=
_slurm_recv
(
open_fd
,
size_buffer_temp
,
sizeof
(
uint32_t
)
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
!=
sizeof
(
uint32_t
)
)
moving_buffer
=
size_buffer
;
{
total_len
=
0
;
info
(
"Error receiving length of datagram. Total bytes received %i"
,
recv_len
)
;
while
(
total_len
<
sizeof
(
uint32_t
)
)
return
0
;
{
if
(
(
recv_len
=
_slurm_recv
(
open_fd
,
moving_buffer
,
sizeof
(
uint32_t
)
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
==
SLURM_SOCKET_ERROR
)
{
info
(
"Error receiving length of datagram. errno %i"
,
errno
)
;
return
recv_len
;
}
if
(
recv_len
>=
0
)
{
total_len
+=
recv_len
;
moving_buffer
+=
recv_len
;
}
}
}
unpack32
(
&
transmit_size
,
(
void
**
)
&
size_buffer
,
&
size_buffer_len
)
;
unpack32
(
&
transmit_size
,
(
void
**
)
&
size_buffer
,
&
size_buffer_len
)
;
moving_buffer
=
buffer
;
total_len
=
0
;
total_len
=
0
;
while
(
total_len
<
transmit_size
)
while
(
total_len
<
transmit_size
)
{
{
if
(
(
recv_len
=
_slurm_recv
(
open_fd
,
moving_buffer
,
transmit_size
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
==
SLURM_SOCKET_ERROR
)
if
(
(
recv_len
=
_slurm_recv
(
open_fd
,
moving_buffer
,
transmit_size
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
==
SLURM_SOCKET_ERROR
)
{
{
info
(
"Error receiving
length of
datagram. errno %i"
,
errno
)
;
info
(
"Error receiving datagram. errno %i"
,
errno
)
;
return
recv_len
;
return
recv_len
;
}
}
if
(
recv_len
>=
0
)
if
(
recv_len
>=
0
)
...
@@ -89,18 +101,23 @@ ssize_t _slurm_msg_sendto ( slurm_fd open_fd, char *buffer , size_t size , uint3
...
@@ -89,18 +101,23 @@ ssize_t _slurm_msg_sendto ( slurm_fd open_fd, char *buffer , size_t size , uint3
char
size_buffer_temp
[
8
]
;
char
size_buffer_temp
[
8
]
;
char
*
size_buffer
=
size_buffer_temp
;
char
*
size_buffer
=
size_buffer_temp
;
unsigned
int
size_buffer_len
=
8
;
unsigned
int
size_buffer_len
=
8
;
/* ignore SIGPIPE so that send can return a error code if the other side closes the socket */
signal
(
SIGPIPE
,
SIG_IGN
);
pack32
(
size
,
(
void
**
)
&
size_buffer
,
&
size_buffer_len
)
;
pack32
(
size
,
(
void
**
)
&
size_buffer
,
&
size_buffer_len
)
;
if
(
(
send_len
=
_slurm_send
(
open_fd
,
size_buffer_temp
,
sizeof
(
uint32_t
)
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
!=
sizeof
(
uint32_t
)
)
if
(
(
send_len
=
_slurm_send
(
open_fd
,
size_buffer_temp
,
sizeof
(
uint32_t
)
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
)
!=
sizeof
(
uint32_t
)
)
{
{
info
(
"Error sending length of datagram"
)
;
info
(
"Error sending length of datagram"
)
;
return
SLURM_PROTOCOL_ERROR
;
}
}
send_len
=
_slurm_send
(
open_fd
,
buffer
,
size
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
;
send_len
=
_slurm_send
(
open_fd
,
buffer
,
size
,
SLURM_PROTOCOL_NO_SEND_RECV_FLAGS
)
;
if
(
send_len
!=
size
)
if
(
send_len
!=
size
)
{
{
info
(
"_slurm_msg_sendto only transmitted %i of %i bytes"
,
send_len
,
size
)
;
info
(
"_slurm_msg_sendto only transmitted %i of %i bytes"
,
send_len
,
size
)
;
return
SLURM_PROTOCOL_ERROR
;
}
}
return
send_len
;
return
send_len
;
...
...
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