FAQ
I use fcgi process HTTP POST request, there will be found after the request
has been processed coroutine, blocking live not quit.

Stack Information:

goroutine 35693 [semacquire, 43 minutes]:
sync. (* Cond) .Wait (0xc20c9f2930)
     /home/my/go1.4/go/src/sync/cond.go:62 + 0x9e
io. (* pipe) .read (0xc20c9f2900, 0xc20a530000, 0x2000, 0x2000, 0x0, 0x0,
0x0)
     /home/my/go1.4/go/src/io/pipe.go:52 + 0x303
io. (* PipeReader) .Read (0xc209ca4208, 0xc20a530000, 0x2000, 0x2000,
0x2000, 0x0, 0x0)
     /home/my/go1.4/go/src/io/pipe.go:134 + 0x5b
io. (* LimitedReader) .Read (0xc209dfce80, 0xc20a530000, 0x2000, 0x2000,
0x2000, 0x0, 0x0)
     /home/my/go1.4/go/src/io/io.go:408 + 0xce
io / ioutil.devNull.ReadFrom (0x0, 0x7fb8a468db80, 0xc209dfce80, 0x8000,
0x0, 0x0)
     /home/my/go1.4/go/src/io/ioutil/ioutil.go:151 + 0xb1
io / ioutil. (* devNull) .ReadFrom (0xc20800a1e0, 0x7fb8a468db80,
0xc209dfce80, 0x7fb8a468dc48, 0x0, 0x0)
     <Autogenerated>: 9 + 0xbb
io.Copy (0x7fb8a4680a18, 0xc20800a1e0, 0x7fb8a468db80, 0xc209dfce80, 0x0,
0x0, 0x0)
     /home/my/go1.4/go/src/io/io.go:358 + 0x13d
io.CopyN (0x7fb8a4680a18, 0xc20800a1e0, 0x7fb8a468dbf8, 0xc209ca4208,
0x6400000, 0x0, 0x0, 0x0)
     /home/my/go1.4/go/src/io/io.go:327 + 0x113
net / http / fcgi. (* child) .serveRequest (0xc20bb66870, 0xc20cdd2480,
0x7fb8a4684a38, 0xc209ca4208)
     /home/my/go1.4/go/src/net/http/fcgi/child.go:272 + 0x23d
     created by net / http / fcgi. (* child) .handleRecord
     /home/my/go1.4/go/src/net/http/fcgi/child.go:212 + 0xbc5

I remove the io.CopyN in net/http/fcgi/child.go file to solve the problems.

262 c.mu.Unlock ()
263 c.conn.writeEndRequest (req.reqId, 0, statusRequestComplete)
264
265 // Consume the entire body, so the host is not still writing to
266 // us when we close the socket below in the! KeepConn case,
267 // otherwise we'd send a RST. (Golang.org/issue/4183)
268 // TODO (bradfitz):. Also bound this copy in time Or send
269 ​​// some sort of abort request to the host, so the host
270 // can properly cut off the client sending all the data.
271 // For now just bound it a little and
272 //io.CopyN(ioutil.Discard, body, 100 << 20) remove io.CopyN
273 body.Close ()
274
275 if! Req.keepConn {
276 c.conn.Close ()
277}
278}

Contrast os_unix.c of libfcgi with timeout control

  726 int OS_Close (int fd)
  727 {
  728 if (fd == -1)
  729 return 0;
  730
  731 if (asyncIoInUse) {
  732 int index = AIO_RD_IX (fd);
  733
  734 FD_CLR (fd, & readFdSet);
  735 FD_CLR (fd, & readFdSetPost);
  736 if (asyncIoTable [index] .inUse! = 0) {
  737 asyncIoTable [index] .inUse = 0;
  738}
  739
  740 FD_CLR (fd, & writeFdSet);
  741 FD_CLR (fd, & writeFdSetPost);
  742 index = AIO_WR_IX (fd);
  743 if (asyncIoTable [index] .inUse! = 0) {
  744 asyncIoTable [index] .inUse = 0;
  745}
  746
  747 if (maxFd == fd) {
  748 maxFd--;
  749}
  750}
  751
  752 / *
  753 * shutdown () the send side and then read () from client until EOF
  754 * or a timeout expires. This is done to minimize the potential
  755 * that a TCP RST will be sent by our TCP stack in response to
  756 * receipt of additional data from the client. The RST would
  757 * cause the client to discard potentially useful response data.
  758 * /
  759
  760 if (shutdown (fd, 1) == 0)
  761 {
  762 struct timeval tv;
  763 fd_set rfds;
  764 int rv;
  765 char trash [1024];
  766
  767 FD_ZERO (& rfds);
  768
  769 do
  770 {
  771 FD_SET (fd, & rfds);
  772 tv.tv_sec = 2;
  773 tv.tv_usec = 0;
  774 rv = select (fd + 1, & rfds, NULL, NULL, & tv);
  775}
  776 while (rv> 0 && read (fd, trash, sizeof (trash))> 0);
  777}
  778
  779 // let ependingpool to close (fd);
  780 // return close (fd);
  781 return 0;
  782}



My environment:
GO 1.4.2
NGINX 1.4.4
nginx set fastcgi_keep_conn on;


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Nigel Tao at Mar 19, 2015 at 6:34 am

    On Mon, Mar 16, 2015 at 6:55 PM, George Luo wrote:
    I use fcgi process HTTP POST request, there will be found after the request
    has been processed coroutine, blocking live not quit.

    268 // TODO (bradfitz):. Also bound this copy in time
    Yes, that TODO immediately above the line you commented out suggests
    that the lack of timeout a known issue.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brad Fitzpatrick at Mar 27, 2015 at 10:51 am
    George,
    On Wed, Mar 18, 2015 at 11:34 PM, Nigel Tao wrote:
    On Mon, Mar 16, 2015 at 6:55 PM, George Luo wrote:
    I use fcgi process HTTP POST request, there will be found after the request
    has been processed coroutine, blocking live not quit.

    268 // TODO (bradfitz):. Also bound this copy in time
    Yes, that TODO immediately above the line you commented out suggests
    that the lack of timeout a known issue.

    Please file a bug. I don't think one exists. (we use the bug tracker more
    than TODOs)

    I don't actively maintain (or even use) the fcgi code. I inherited it by
    virtue of being http-ish and by accepting it into the standard library in
    the first place.

    But if you have a repro, it's much easier for us to include it as a test
    and fix the bug.

    Thanks!

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 16, '15 at 7:55a
activeMar 27, '15 at 10:51a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase