[ https://issues.apache.org/jira/browse/PROTON-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758700#comment-17758700 ]
ASF GitHub Bot commented on PROTON-2748: ---------------------------------------- cliffjansen commented on code in PR #402: URL: https://github.com/apache/qpid-proton/pull/402#discussion_r1304730556 ########## c/src/proactor/epoll_raw_connection.c: ########## @@ -408,32 +415,41 @@ pn_event_batch_t *pni_raw_connection_process(task_t *t, uint32_t io_events, bool } unlock(&rc->task.mutex); - if (events & EPOLLIN) pni_raw_read(&rc->raw_connection, fd, rcv, set_error); - if (events & EPOLLOUT) pni_raw_write(&rc->raw_connection, fd, snd, set_error); - rc->batch_empty = false; + if (rc->connected) { + if (events & EPOLLERR) { + // Read and write sides closed via RST. Tear down immediately. + int soerr; + socklen_t soerrlen = sizeof(soerr); + int ec = getsockopt(fd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen); + if (ec == 0 && soerr) { + psocket_error(rc, soerr, "async disconnect"); + } + pni_raw_async_disconnect(&rc->raw_connection); + } else if (events & EPOLLHUP) { + rc->hup_detected = true; + } + + if (events & (EPOLLIN || EPOLLRDHUP) || rc->read_check) { Review Comment: Quadruple D'oh. s/||/|/ was the intention and passes the the tests. > Raw connections do not always complete close operations > ------------------------------------------------------- > > Key: PROTON-2748 > URL: https://issues.apache.org/jira/browse/PROTON-2748 > Project: Qpid Proton > Issue Type: Bug > Components: proton-c > Affects Versions: proton-c-0.39.0 > Environment: linux epoll > Reporter: Clifford Jansen > Assignee: Clifford Jansen > Priority: Major > Attachments: pn2748.patch > > > The Proton raw_connection_t currently requires cooperation from the > application layer to complete a close. There is a baked in assumption that > the application will always eventually provide a read buffer. A second > assumption is that the peer (not necessarily a Proton raw connection) will > detect a read close on its side, and do a graceful close of it's write side > "soon". > These incorrect assumptions can leave the raw connection in a hung state > waiting for non-existent wind up activity by the application or peer, > respectively. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org