The following code got me a socket timeout error:
for trip in session.trip_cart:
t_id = trip['trip_instance']
num_trav = trip['quantity'] - 1
while num_trav > 0:
new_trav = dict()
for k, v in request.vars.items():
#get the field's trip_instance number
#rest of code omitted.
Traceback (most recent call last):
File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line
1064, in run
self.run_app(conn)
File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line
1531, in run_app
self.environ = environ = self.build_environ(sock_file, conn)
File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line
1363, in build_environ
request = self.read_request_line(sock_file)
File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line
1138, in read_request_line
raise SocketTimeout("Socket timed out before request.")
SocketTimeout: Socket timed out before request.
Through use of the debugger I've determined that the line that is
causing the error is:
for k, v in request.vars.items()
This is strange to me because I've used that same line in other places
but I've never had a problem with it.
One possibility is that this code is part of a larger function (so now
the function maybe takes too long?), but a the function ran fine
before the above code was added. I see that the socket times out
after 10 seconds but this error seems to happen almost instantaneously
when I submit my form.
One last strange occurrence is that when I clicked the ticket for the
above error, Google Chrome opened the ticket and also popped up the
following message in an alert box:
"Exception during snapshot rendering: Traceback (most recent call
last):
File
"C:path_to_my_web2py/admin/viewsdefault/ticket.html", line
170, in <module>
KeyError: 'request'
I've never had Google Chrome pop up an alert for any of my tickets
although this might be unrelated.