Bug #40556 [Com]: Browser abort causes server hang with FastCGI

From: Date: Fri, 05 Dec 2014 19:28:05 +0000
Subject: Bug #40556 [Com]: Browser abort causes server hang with FastCGI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188942@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=40556&edit=1

 ID:                 40556
 Comment by:         dmanea28 at gmail dot com
 Reported by:        unreal at slashorg dot net
 Summary:            Browser abort causes server hang with FastCGI
 Status:             No Feedback
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   Linux 2.6.18
 PHP Version:        5.2.1
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Try calling 
session_write_close();
before reading the file.


Previous Comments:
------------------------------------------------------------------------
[2007-04-05 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2007-03-28 08:44:22] tony2001@php.net

>Here's a backtrace, tell me if this helps you
The backtrace shows that write() syscall blocks when trying to write to an invalid socket.
Not something PHP can fix..

------------------------------------------------------------------------
[2007-03-23 15:29:28] unreal at slashorg dot net

Some more information:

The issue only seems to appear when the client abandons the connection without ending the http
session properly. For example, we have an antivirus gateway appliance that drops the connection with
a tcp-reset when the browser cancels. PHP doesn't seem to get informed that the connection has
ended and becomes non responsive until some timeout (?) occures. If I use "lsof" while the
php process is blocked, I can see the process is still accessing the download file...

------------------------------------------------------------------------
[2007-03-23 14:55:39] unreal at slashorg dot net

Here's a backtrace, tell me if this helps you:

(gdb) attach 1774
Attaching to process 1774.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ................ done
0x900101b7 in write ()
(gdb) backtrace
#0  0x900101b7 in write ()
#1  0x004007c4 in safe_write (req=0x0, buf=0xbffffeb4, count=0) at
/home/unreal/compile/php-5.2.1/sapi/cgi/fastcgi.c:351
#2  0x00002095 in start ()
(gdb)

------------------------------------------------------------------------
[2007-03-23 10:11:57] tony2001@php.net

>I guess I have to recompile php with debug support?
Yes, rebuild with --enable-debug is required.
- start PHP/FastCGI with just one process (-processes 1) 
- figure out pid of PHP (ps afx | grep php or see Apache error_log)
- start gdb (just type gdb and enter), then type "attach <pid of php>", this way
you'll attach to already running PHP process.
- type "continue" for the process to continue running.
- after that reproduce the problem and see if the process stops.
- if it does, type "backtrace" and paste the output here.
- if it doesn't we'll continue in the next post.

You can also create an account on the server, I'll try to reproduce it myself. 

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=40556


--
Edit this bug report at https://bugs.php.net/bug.php?id=40556&edit=1


Thread (14 messages)

« previous php.bugs (#188942) next »