TCP_CORK option is never turned off
Valentin V. Bartenev
vbart at nginx.com
Tue May 7 14:05:06 UTC 2013
On Tuesday 07 May 2013 14:49:07 Yury Kirpichev wrote:
> Hi,
>
> I've got an issue when trying to use SPDY over HTTP for nginx.
>
> I'm using nginx 1.4.0.
>
> The issue is that there is 200ms delay between request is sent to server
> and response with data is received.
>
>
> After analysing this issue a little bit, it turned out that TCP_CORK option
> is set before sendfile is called and never reset afterwards.
>
> 9910 0.000165 writev(3,
> [{"\200\2\0\4\1\0\0\f\0\0\0\1\4\0\0\1\0\0\0d", 20},
> {"\200\2\0\2\0\0\0\370\0\0\0\1\0\00080\337\242Q\262\0\342\0\35\377\0\t\0\7v
> er"..., 256}], 2) = 276
> 9910 0.000121 setsockopt(3, SOL_TCP, TCP_CORK, [1], 4) = 0
> 9910 0.000040 writev(3, [{"\0\0\0\1\1\0\0L", 8}], 1) = 8
> 9910 0.000052 sendfile(3, 14, [0], 76) = 76
> 9910 0.000054 write(5, "84.201.173.232 - - [07/May/2013:"..., 203) =
> 203
> 9910 0.000043 close(14) = 0
> 9910 0.000162 recvfrom(3, 0x7fddc6670010, 262112, 0, 0, 0) = -1
> EAGAIN (Resource temporarily unavailable)
> 9910 0.000253 epoll_wait(12, {{EPOLLIN, {u32=3328906192,
> u64=140590493406160}}}, 512, 180000) = 1
> 9910 0.218032 recvfrom(3,
> "\200\2\0\1\1\0\0u\0\0\0\3\0\0\0\0\200\0B\212bf`d\r\252h\"*6\0041"...,
> 262112, 0, NULL, NULL) = 125
> 9910 0.000391 open("/etc/nginx/html/favicon.ico",
> O_RDONLY|O_NONBLOCK) = 14
> 9910 0.000353 fstat(14, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
> 9910 0.000273 writev(3,
> [{"\200\2\0\2\1\0\0\256\0\0\0\3\0\0\0\236\0a\377\0\6\0\7version\0\10"...,
> 182}], 1) = 182
> 9910 0.000267 write(5, "84.201.173.232 - - [07/May/2013:"..., 213) =
> 213
> 9910 0.000300 close(14) = 0
>
> I tried to disable tcp_nopush using config file, but result is always the
> same.
>
> Could you please help me to resolve this issue?
Thank you for the report. I will look for the right solution.
wbr, Valentin V. Bartenev
>
> As temporary solution I just commented out the following code in my local
> source:
> int
> ngx_tcp_nopush(ngx_socket_t s)
> {
> #if 0
> int cork;
>
> cork = 1;
>
> return setsockopt(s, IPPROTO_TCP, TCP_CORK,
> (const void *) &cork, sizeof(int));
> #else
> return 0;
> #endif
> }
> And issue disappeared after that.
> However, I need a permanent solution for this problem.
>
> BR/ Yury
More information about the nginx-devel
mailing list