From nobody  Mon Sep  7 00:32:36 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id AAA03303;
          Mon, 7 Sep 1998 00:32:36 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199809070732.AAA03303@hub.freebsd.org>
Date: Mon, 7 Sep 1998 00:32:36 -0700 (PDT)
From: ga@carmenta.se
To: freebsd-gnats-submit@freebsd.org
Subject: Unbuffered /dev/vx0-output from Python 1.5.1 hangs CPU in a busy wait
X-Send-Pr-Version: www-1.0

>Number:         7845
>Category:       ports
>Synopsis:       Unbuffered /dev/vx0-output from Python 1.5.1 hangs CPU in a busy wait
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep  7 00:40:00 PDT 1998
>Closed-Date:    Thu Jan 13 17:56:16 PST 2000
>Last-Modified:  Thu Jan 13 17:58:32 PST 2000
>Originator:     Mr Goran Allerbo
>Release:        2.2.7
>Organization:
Carmenta
>Environment:
FreeBSD p11-055.carmenta.se 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Wed Jul 22 08:48:29 GMT 1998     ro
ot@builder.cdrom.com:/usr/src/sys/compile/GENERIC  i386

>Description:
Using the standard SocketServer.py hangs the CPU in a busy wait.

The SocketServer.py normally does a :
self.wfile = self.connection.makefile( 'wb', 0 ) # unbuffered IO
this courses the CPU to hang in its self.wfile.write() ( socket write ) ...


>How-To-Repeat:
Run the SimpleHTTPServer.py and put some load on it. 
I simulated 50 concurrent users giving a total of 5 hits/sec. 

Kill the calling browsers brutally so that when the web-server 
writes to the socket on which the client emitted its call, 
the client is not there anymore.

This will course the web-server to hang in its self.wfile.write()...




>Fix:
Doing :
self.wfile = self.connection.makefile( 'wb', -1) # defaultbuffered IO
works just great as far as I can see.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-ports 
Responsible-Changed-By: steve 
Responsible-Changed-When: Mon Sep 7 14:57:14 PDT 1998 
Responsible-Changed-Why:  
Misfiled PR. 
Responsible-Changed-From-To: freebsd-ports->tg 
Responsible-Changed-By: steve 
Responsible-Changed-When: Thu Dec 24 13:02:02 PST 1998 
Responsible-Changed-Why:  
Over to port's maintainer. 
State-Changed-From-To: open->feedback 
State-Changed-By: steve 
State-Changed-When: Fri Dec 31 15:03:51 PST 1999 
State-Changed-Why:  
Does this problem still exist with the latest version of the port? 
State-Changed-From-To: feedback->closed 
State-Changed-By: steve 
State-Changed-When: Thu Jan 13 17:56:16 PST 2000 
State-Changed-Why:  
Originator says that he could not make it work in FreeBSD and isn't 
using it anymore.  Since this is a very old PR and several newer 
versions of Python have come and gone, we'll cross our fingers that 
the problem has been resolved and close this PR. 
>Unformatted:
