On 24 Jan 2022, at 17:21, Yann Ylavic <ylavic....@gmail.com> wrote: > Maybe the resume_suspended hook is a misnomer? We also have the > suspend_connection and resume_connection hooks which mean the opposite > (called when added to and removed from the queues respectively).
The ap_mpm_resume_suspended() is a function rather than a hook. This is what gets called when you’ve decided your external condition has been met (DNS lookup finished, etc), and the connection should carry on back to pumping data like it did before. The two hooks suspend_connection and resume_connection allow code that cares to know when something is being paused and unpaused. Right now what’s confusing is there is no ap_mpm_suspend() function, the module is expected to do the suspend stuff by hand: https://github.com/apache/httpd/blob/3ec0ffb9e1ac05622b97a7afd6992dd2bd41ce38/modules/http/http_request.c#L476 > It sounds more natural to me to think that the connection (processing) > is suspended when it's in the MPM, than suspended from any MPM action > when it's outside the MPM (all the connections being processed outside > the MPM are not in any MPM queue anyway), but YMMV ;) There are two types of suspended: - AGAIN/APR_EAGAIN: The socket does not have data for me to read, or the write buffer is full and I can no longer write, go into select/poll in the MPM and when I can either read or write call me again so I can carry on. In the mean time, I’m not hogging the connection, other requests get a go. This is new, previously we just blocked and clogged up everything, hogging the slot. Yuck. - SUSPENDED/CONN_STATE_SUSPENDED: I don't care about my socket, don’t call me. If there is data there to read or space on the buffer for me to write I don’t care, completely ignore me for now. Maybe I am throttling a connection, maybe I’m waiting for DNS, maybe it’s the backend proxy’s turn to read. At some point in the future a condition will get fulfilled, and I’ll un-suspend/resume this connection, but in the mean time, pretend I don’t exist. Here is mod_dialup telling the core that it wants to go to sleep: https://github.com/apache/httpd/blob/1032155c5720e167446efceb4b8e0b545851b7a4/modules/test/mod_dialup.c#L99 Here is mod_dialup telling the core that enough delay has passed, it wants to wake back up: https://github.com/apache/httpd/blob/1032155c5720e167446efceb4b8e0b545851b7a4/modules/test/mod_dialup.c#L138 Regards, Graham —