[Twisted-web] livepage connection "timing out"/dying randomly
robbyd at u20.org
Thu Oct 27 11:50:17 MDT 2005
I seem to have a problem with client browsers to my guarded livepage
application loosing their livepage connections. It seems that the guard
session doesn’t expire, but the livepage system on the server side seems
like it will loose track of the client’s nevow handle. This is under the
Nevow 0.5.0 release, and it happens under both IE 6.0.x and Firefox 1.0.x.
Basically, my server app makes livepage calls to the client browser js
via clientHandle.call() to reflect dynamically updated data as it
happens… (maybe one call every 4 seconds). At this point I found this
problem (that at some point these updates in the client would stop,
while the server was still making the livepage call() invocations like
everything was fine and dandy). The problem was that things just seemed
to die, and I could find no error output showing why.
Well, in my search for a fix/error output, I added a js function on the
client that calls server.handle('refreshSession()') every 120 seconds
via the use of repeated setTimeout() calls. The corresponding
handle_refreshSession() function on the server gets that client's
session object and touch()es it.
This will start out working fine for usually a few hours (the session
timeout is 1200 seconds currently), and the client will stay logged in.
Then after some seemingly arbitrary amount of time, I will start getting
the following errors, one set for each refreshSession() call:
From the client side (firefox java console):
Error: syntax error
Source File: http://188.8.131.52:8800/mon/nevow_glue.js
From a glance at nevow_glue.js, it looks like the server returned an
exception page to the client and nevow_clientToServerEvent() in
nevow_glue.js didn’t like that when it tried to evaluate it as
On the server side I get the following python exception:
---**** EXCEPTION START ****---
Traceback (most recent call last):
line 216, in addCallback
line 207, in addCallbacks
line 328, in _runCallbacks
self.result = callback(self.result, *args, **kw)
File "/usr/lib/python2.4/site-packages/nevow/appserver.py", line 308,
--- <exception caught here> ---
line 117, in maybeDeferred
result = f(*args, **kw)
File "/usr/lib/python2.4/site-packages/nevow/livepage.py", line 596,
client = self.clientFactory.clientHandles[handleId]
---**** EXCEPTION END ****---
In this case, the key ‘2’ was the setting of the client’s
“nevow_clientHandleID” variable. This will happen every time the client
tries to make the call (e.g. every 120 seconds).
I think these two types of updates I’m doing (one where the server tries
to call a js method on the client when its data is updated, and one
where the client periodically “pings” the server) are both exposing the
same error. The only difference is that the one where the client pings
the server with the server.handle() call exposes some error messages of
what may be going wrong.
Might I be forgetting to do something, or using livepage improperly? My
goal is to make it so that, as long as a client’s browser is logged in
and at my page, they will keep getting livepage events indefinitely.
Might the newest version from the repository fix this?
Thanks for any help,
More information about the Twisted-web