Welcome! Log In Create A New Profile

Advanced

Early output by a fastcgi app stops the body sending process

Maxime Bizon
May 25, 2010 05:04PM
Hi list,

I'm writing a FastCGI application, in which I do "lazy" POST data
access, meaning stdin is not read until it's needed. That mean that data
can be sent on stdout before stdin is fully read.

But it seems nginx stops writing to stdin (and close the body temp file)
the first time it gets data on stdout:

open("/tmp/nginx/body/0000000007", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE,
0600) = 9
unlink("/tmp/nginx/body/0000000007") = 0
_llseek(9, 0, [0], SEEK_CUR) = 0
_llseek(9, 0, [0], SEEK_SET) = 0
write(9, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 8192) = 8192
_llseek(9, 0, [0], SEEK_SET) = 0
recv(6, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 8192, 0) = 8192
[...]
connect(10, {sa_family=AF_FILE, path="/tmp/fcgi"}, 110) = 0
getsockopt(10, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
writev(10, [{"\1\1\0\1\0\10\0\0\0\1\0\0\0\0\0\0\1\4\0\1\2^\2\0\f\5QUERY_"..., 648}, {"test=aaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 832}, {"\1\5\0\1\200\0\0\0", 8}], 3) = 1488
sendfile64(10, 9, [0], 32768) = 32768
writev(10, [{"\1\5\0\1\200\0\0\0", 8}], 1) = 8
sendfile64(10, 9, [32768], 32768) = 32768
writev(10, [{"\1\5\0\1\200\0\0\0", 8}], 1) = 8
sendfile64(10, 9, [65536], 32768) = 32768
writev(10, [{"\1\5\0\1\200\0\0\0", 8}], 1) = 8
sendfile64(10, 9, [98304], 32768) = 20480
epoll_wait(0x8, 0x90558, 0x200, 0xea60) = 2
rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
gettimeofday({1274818417, 182822}, NULL) = 0
recv(6, 0xbee19b17, 1, MSG_PEEK) = -1 EAGAIN (Resource temporarily unavailable)
recv(10, "\1\6\0\1\0\200\0\0Status: 200\r\nContent-Typ"..., 4096, 0) = 272
close(9) = 0
readv(10, 0xbee199fc, 1) = -1 EAGAIN (Resource temporarily unavailable)


Is it expected ?

from the fastcgi specs:

> The application must wait to finish reading FCGI_PARAMS before it
> begins writing FCGI_STDOUT and FCGI_STDERR, but it needn't finish
> reading from FCGI_STDIN before it begins writing these two streams.

Thanks,

--
Maxime



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Early output by a fastcgi app stops the body sending process

Maxime Bizon 2499 May 25, 2010 05:04PM

Re: Early output by a fastcgi app stops the body sending process

Maxim Dounin 1303 May 26, 2010 06:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 324
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready