Skip to content

Replace writev by sendmsg #11915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Replace writev by sendmsg #11915

merged 1 commit into from
Sep 21, 2023

Conversation

bosilca
Copy link
Member

@bosilca bosilca commented Sep 7, 2023

This allows the TCP BTL to avoid raising SIGPIPE on OSes that do not support SO_NOSIGPIPE.

@bosilca bosilca requested a review from abouteiller September 7, 2023 19:10
@bosilca bosilca added this to the v5.0.0 milestone Sep 7, 2023
This allows the TCP BTL to avoid raising SIGPIPE on OSes that do not
support SO_NOSIGPIPE.

Correctly use the unsigned type of the vpid when using it as a starting
position for finding the process rank in a group.

Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
@bosilca
Copy link
Member Author

bosilca commented Sep 20, 2023

running out of disk space for the rocm build.

@jsquyres
Copy link
Member

running out of disk space for the rocm build.

Hey @edgargabriel this came up again. Is there some kind of disk space limit in Github Actions, and we just happen to be running up against it in the RoCM build action for some reason?

@bosilca bosilca merged commit 2ebdfbb into open-mpi:main Sep 21, 2023
@bosilca bosilca deleted the topic/avoid_writev branch September 21, 2023 18:57
@jsquyres
Copy link
Member

@bosilca @abouteiller Is this worth bringing to v5.0.x?

@bosilca
Copy link
Member Author

bosilca commented Sep 21, 2023

It helps deal with SIGPIPE on some odd systems. Worth it !

@abouteiller
Copy link
Member

I think it would be beneficial yes

@jsquyres
Copy link
Member

Why are there changes to group.h in this PR -- was that an accidental oversight?

I think the change is harmless, but it doesn't seem to be part of "Replace writev by sendmsg".

@bosilca
Copy link
Member Author

bosilca commented Sep 22, 2023

Correct, the change in group.h is a performance improvement change that is not related to the sendmsg change. They ended up together because they were discovered in the same debugging session.

@jsquyres
Copy link
Member

@bosilca @abouteiller Got a Coverity alert about this new code:

*** CID 1545093:  Uninitialized variables  (UNINIT)
/opal/mca/btl/tcp/btl_tcp_frag.c: 123 in mca_btl_tcp_frag_send()
117    
118         /* non-blocking write, continue if interrupted */
119         do {
120             /* Use sendmsg to avoid issues with SIGPIPE as described in
121              * https://blog.erratasec.com/2018/10/tcpip-sockets-and-sigpipe.html#
122              */
>>>     CID 1545093:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "msg". Field "msg.msg_flags" is uninitialized when calling "sendmsg".
123             cnt = sendmsg(sd, &msg, msg_flags);
124             if (cnt < 0) {
125                 switch (opal_socket_errno) {
126                 case EINTR:
127                     continue;
128                 case EWOULDBLOCK:

@bosilca
Copy link
Member Author

bosilca commented Sep 22, 2023

According to the documentation msg.msg_flags is not used for sendmsg, it is only used for recvmsg as a mean to get information about the received message.

@jsquyres
Copy link
Member

If we use the C99 initialization, wouldn't that initialize all non-specified members to the zero value? E.g.:

 struct msghdr msg = {
    .msg_iov = frag->iov_ptr,
    .msg_iovlen = frag->iov_cnt,
};

I realize that you're saying we don't need to care about msg.msg_flags for sending, but it would be nice to obviate this warning and not have to explain it every time it comes up. 😄

@bosilca
Copy link
Member Author

bosilca commented Sep 22, 2023

The aggregate initialisation will set the not-explicitly initialised members to their default values (NULL or zero). But this is not really a correctness issue, it is writing code in an unnecessary complicated way to make a code-analysis tool happy.

bosilca added a commit to bosilca/ompi that referenced this pull request Sep 22, 2023
Removes complaints from coverity about msg.msg_flags not being set. For
more information about this read the discussion on open-mpi#11915.

Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
@jsquyres
Copy link
Member

PR #11940 removed 5 lines of code -- what's not to love? 😜

bosilca added a commit to bosilca/ompi that referenced this pull request Feb 14, 2024
Removes complaints from coverity about msg.msg_flags not being set. For
more information about this read the discussion on open-mpi#11915.

Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants