Skip to content
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

prov/tcp: Process EPOLLERR properly #10813

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jxiong
Copy link

@jxiong jxiong commented Feb 21, 2025

The original code just clears MSG_ERRQUEUE but not handle SO_ERROR, which makes the socket always have something to report from epoll.

The original code just clears MSG_ERRQUEUE but not handle SO_ERROR,
which makes the socket always have something to report from epoll.

Signed-off-by: Jinshan Xiong <[email protected]>
}
if (val != 0) {
FI_WARN(prov, FI_LOG_EP_DATA,
"Socket error (%s)\n", strerror(val));
Copy link
Author

@jxiong jxiong Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we could fetch remote address here in the log message, something like this:

ssize_t get_remote_addr(char *buf, size_t buflen, int sockfd) {
        struct sockaddr_in remote_addr;
        socklen_t addr_len = sizeof(remote_addr);

        if (getpeername(sockfd, (struct sockaddr *)&remote_addr, &addr_len) == -1) {
    strerror_r(errno, buf, buflen);
                return 0;
  }

        char remote_ip[INET_ADDRSTRLEN];
        if (inet_ntop(AF_INET, &(remote_addr.sin_addr), remote_ip, INET_ADDRSTRLEN) == NULL) {
    strerror_r(errno, buf, buflen);
                return 0;
  }

        int remote_port = ntohs(remote_addr.sin_port); // Network to host short

        return snprintf(buf, buflen, "%s:%d", remote_ip, remote_port);
}

but I don't know how to make more generic in the context of libfabric

@shefty @j-xiong FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant