DevHeads.net

Non Blocking write in apache

Hi All,

I am using proxy_http to proxy my request to tomcat from apache. But in
non-blocking call it is not working properly(timeout issue). I am using the
default timeout i:e 60 sec.

When writev returns -1 with errorno==4101, it should wait and then again
try for write.
while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK)
&& (sock->timeout > 0)) _____ code snippet from
sendrecv.c

In debugging I have checked that sock->timeout is equal to 0. Therefore
this condition is failed and request failed.

When default timeout is 60sec then why does sock->timeout becomes 0 ??

On further debugging, I came to know the reqtimeout_eor function is setting
timeout to 0.

static apr_status_t reqtimeout_eor(ap_filter_t *f, apr_bucket_brigade *bb)
{
if (!APR_BRIGADE_EMPTY(bb) && AP_BUCKET_IS_EOR(APR_BRIGADE_LAST(bb))) {
reqtimeout_con_cfg *ccfg = f->ctx;
ccfg->timeout_at = 0;
}
return ap_pass_brigade(f->next, bb);
}

I am not able to understand why this function is setting to 0.

Can somebody help me to understand the issue ?

Thanks
Hemant