Mantis - Resin
Viewing Issue Advanced Details
5203 major always 08-01-12 05:19 08-01-12 11:03
ssmax  
ferg  
normal  
closed 4.0.29  
fixed  
none    
none 4.0.31  
0005203: mod_caucho.so make wrong socket timeout in linux
resin pro 4.0.29 --enable-64bit --enable-jni --with-apxs=...
jdk: oracle java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
apache: 2.2.4 / 2.2.22
os: centos 5.8 final
kernel: 2.6.18-308.1.1.el5 / 2.6.18-308.13.1.el5 / etc..

when use resin as a srun server behind apache httpd, every pages that load over 5 seconds in resin will lead to a 503 reponse in apache.

i use an old version mod_caucho.so (4.0.24) to replcace the new one , and keep it connect to the new resin ( 4.0.29 ), it works fine.

after a long time trace, i found some new code in 4.0.29:

resin-pro-4.0.29/modules/c/src/common/stream.c

#define WINDOWS_READ_TIMEOUT 3600
...
  srun->read_timeout = WINDOWS_READ_TIMEOUT;
...

#ifdef HAS_SOCK_TIMEOUT
  timeout.tv_sec = srun->read_timeout / 1000;
  timeout.tv_usec = srun->read_timeout % 1000 * 1000;

  setsockopt(s->socket, SOL_SOCKET, SO_RCVTIMEO,
             (char *) &timeout, sizeof(timeout));

  timeout.tv_sec = srun->read_timeout / 1000;
  timeout.tv_usec = srun->read_timeout % 1000 * 1000;
  setsockopt(s->socket, SOL_SOCKET, SO_SNDTIMEO,
             (char *) &timeout, sizeof(timeout));
#endif



i think srun->read_timeout should be used for windows here , stands for one hour(3600 seconds).

but when compile the code in linux, the flag HAS_SOCK_TIMEOUT is defined.
so the code will stop all response which write first byte after 3.6 seconds.

i try to modify srun->read_timeout to a bigger value , and recompile it , then everything goes right.

there are some bugs in the recent update of resin , i think you guys should care more about the part of c code....

There are no notes attached to this issue.