Bugs item #1705393, was opened at 2007-04-22 17:38
Message generated for change (Comment added) made by gagenellina
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1705393&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ron Garret (rongarret)
Assigned to: Nobody/Anonymous (nobody)
Summary: Select() failure (race condition)

Initial Comment:
select.select fails on file-like objects created by socket.makefile when data 
exists in the file buffer but not in the underlying socket.

Here is code to reproduce the bug.  Run it, then point a web browser at port 
8080 and observer that select times out indicating that no input is available 
even though input is still in fact available.

=======

from SocketServer import *
from socket import *
from select import select

class myHandler(StreamRequestHandler):
  def handle(self):
    while 1:
      sl = select([self.rfile],[],[],1)[0]
      print sl
      l = self.rfile.readline()
      if len(l)<3: break
      print l,
      pass
    print>>self.wfile, 'HTTP/1.0 200 OK'
    print>>self.wfile, 'Content-type: text/plain'
    print>>self.wfile
    print>>self.wfile, 'foo'

server = TCPServer(('',8080), myHandler)
server.serve_forever()


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

Comment By: Gabriel Genellina (gagenellina)
Date: 2007-04-23 01:53

Message:
Logged In: YES 
user_id=479790
Originator: NO

The handler should not do its own select() call. (And even then, select
should use the underlying socket, not the wrapping pseudo-file object).
Just removing the select() call works fine.


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1705393&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to