nickva commented on PR #4729:
URL: https://github.com/apache/couchdb/pull/4729#issuecomment-1686633468

   On localhost `keepalive` won't behave any differently for disconnects, as 
network handling is just a direct callback into the other peer's socket code at 
the kernel level. In other words the socket will find out it's closed anyway. 
For remote connection it's a different story and keepalive will be useful there.
   
   So keepalive is useful as a step 0 - to allow the socket at the kernel level 
to become closed. However that is not enough for us, what is missing is at the 
HTTP protocol stage in mochiweb we do not have a reason do any socket 
operations (and we can't do any extra ones outside of mochweb in a sneaky way 
so far it seems, which is what I was getting at above). We're forced to wait 
for the `mango` application to return a response. Without any attempted writes 
or reads to socket at the mochiweb level won't have a way to find out the 
socket is closed. Which could come after days of waiting in pathological cases 
like we saw already.
   
   The only solutions I see so far is to either modify mango to periodically 
handle a timeout and push a `\n` between row (after forcing to emit headers on 
the first timeout) or find some possibly non-portable raw socket getops query 
to detect that the socket is closed out-of-band as it were. We could enhance 
the existing `fabric_stream` monitor to periodically check it or invent some 
new thing (maybe some new thing in mochiweb even).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to