[ https://issues.apache.org/jira/browse/PROTON-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763240#comment-17763240 ]
ASF GitHub Bot commented on PROTON-2748: ---------------------------------------- cliffjansen commented on code in PR #402: URL: https://github.com/apache/qpid-proton/pull/402#discussion_r1320280918 ########## c/src/proactor/epoll_raw_connection.c: ########## @@ -442,24 +458,31 @@ void pni_raw_connection_done(praw_connection_t *rc) { // The task may be in the ready state even if we've got no raw connection // wakes outstanding because we dealt with it already in pni_raw_batch_next() notify = (pni_task_wake_pending(&rc->task) || have_event) && schedule(&rc->task); - ready = rc->task.ready; + ready = rc->task.ready; // No need to poll. Already scheduled. unlock(&rc->task.mutex); - pn_raw_connection_t *raw = &rc->raw_connection; - int fd = rc->psocket.epoll_io.fd; - pni_raw_process_shutdown(raw, fd, shutr, shutw); - int wanted = - (pni_raw_can_read(raw) ? EPOLLIN : 0) | - (pni_raw_can_write(raw) ? EPOLLOUT : 0); - if (wanted) { - rc->psocket.epoll_io.wanted = wanted; - rearm_polling(&rc->psocket.epoll_io, p->epollfd); // TODO: check for error + bool finished_disconnect = raw->state==conn_fini && !ready && !raw->disconnectpending; + if (finished_disconnect) { + // If we're closed and we've sent the disconnect then close + pni_raw_finalize(raw); + praw_connection_cleanup(rc); + } else if (ready) { + // Already scheduled to run. Skip poll. Remember if we want a read. + rc->read_check = pni_raw_can_read(raw); + } else if (!rc->connected) { + // Connect logic has already armed the socket. } else { - bool finished_disconnect = raw->state==conn_fini && !ready && !raw->disconnectpending; - if (finished_disconnect) { - // If we're closed and we've sent the disconnect then close - pni_raw_finalize(raw); - praw_connection_cleanup(rc); + // Must poll for iO. Review Comment: fixed > 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