[ 
https://issues.apache.org/jira/browse/PROTON-2818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17843789#comment-17843789
 ] 

ASF GitHub Bot commented on PROTON-2818:
----------------------------------------

cliffjansen commented on code in PR #427:
URL: https://github.com/apache/qpid-proton/pull/427#discussion_r1591276038


##########
c/src/proactor/epoll_raw_connection.c:
##########
@@ -413,6 +422,19 @@ pn_event_batch_t *pni_raw_connection_process(task_t *t, 
uint32_t io_events, bool
     }
     if (events & EPOLLOUT)
       praw_connection_connected_lh(rc);
+    if (rc->first_schedule) {
+      // Normal case: resumed logic from pn_proactor_raw_connect.
+      // But possible tie: pn_raw_connection_wake()
+      // Defer wake check until getaddrinfo is done.
+      rc->first_schedule = false;
+      assert(!events); // No socket yet.
+      praw_connection_first_connect_lh(rc);  // Drops and reacquires lock.
+      if (rc->psocket.epoll_io.fd != -1 && !pni_task_wake_pending(&rc->task)) {
+        unlock(&rc->task.mutex);
+        return NULL;
+      }
+    }

Review Comment:
   Hopefully addressed in the reworked version.
   
   Agreed about the lifecycle state issue.  This proposed fix strives for the 
minimal code logic changes to move the blocking activity to a different thread. 
 The subsequent "real fix" for the parent JIRA will necessarily introduce a new 
state (presumably with early cancel option compared to the current 
blocked-until-done).  The initiating of the getaddrinfo call will also 
presumably be sensibly moved back to the pn_xxx_connect call to avoid a 
pointless thread switch and the first_call boolean will have no purpose.
   





> Move epoll proctor connection logic to a task thread
> ----------------------------------------------------
>
>                 Key: PROTON-2818
>                 URL: https://issues.apache.org/jira/browse/PROTON-2818
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: proton-c-0.39.0
>            Reporter: Clifford Jansen
>            Assignee: Clifford Jansen
>            Priority: Major
>
> See PROTON-2812.  Implement the first described mitigation.



--
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

Reply via email to