Bug in widget.py: lack type='int' in new added --socket-timeout param

66 views
Skip to first unread message

evantan

unread,
Dec 27, 2011, 3:39:38 AM12/27/11
to web...@googlegroups.com
In version 1.99.4,  socket-timeout was added to start params, which is very needed to  tuning socket.settimeout in rocket.py. The default value 1 second often lead to " <class 'socket.timeout'>(timed out) " error in a slow network,such as WAN than LAN.

But  in widget.py line 557:

    parser.add_option('--socket-timeout',
                      default=1,
                      dest='socket_timeout',
                      help='timeout for socket (1 second)')

lack a type to cast this param.Should be:

    parser.add_option('--socket-timeout',
                      default=1,
                      type='int',
                      dest='socket_timeout',
                      help='timeout for socket (1 second)')


This bug lead to deadly exceptions(see below) when set "python web2py.py ... --socket-timeout=60 ..." in start time: 

------>Traceback
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/home/git/web2py/gluon/rocket.py", line 1282, in run
    conn = Connection(*conn)
  File "/home/git/web2py/gluon/rocket.py", line 130, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
  File "/usr/local/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
TypeError: a float is required
<-----Traceback

Massimo Di Pierro

unread,
Dec 27, 2011, 11:16:20 AM12/27/11
to web2py-users
Thanks I changed to 60secs by default and type casted to int as you
suggested.

Carlos

unread,
Dec 28, 2011, 11:51:21 AM12/28/11
to web...@googlegroups.com
Hi,

Not sure if this is the actual cause of my problem, but after loading this changeset (9619eb054669 / Socket timeout is now int an defaults to 60secs), multiple semi-concurrent requests from different browsers (IE / firefox / chrome / opera / safari) to the same page (web2py function) take a very long time or even fail, which was not happening prior to that change.

If I load the previous changeset, then it seems to work correctly.

I'm using latest trunk on win7.

Thanks.

   Carlos

Reply all
Reply to author
Forward
0 new messages