Mystery of jsonrpc call that never completes

Firebug 1.2 alpha (Ubuntu)

Image via Wikipedia

Recently I came across an interesting problem (to say the least) where jsonrpc call would execute the error call back function, but did not provide the details.  Additionally (as the title suggests) Firebug showed that the call never completed. Firebug continues to show rotating ring next to this call. But server logs suggested that server not only received the call, but it also processed the request completely.

I googled for “jsonrpc never completes” (and other similar terms) But no one had faced the problem. Strange :)

Normally, when jsonrpc call executes error callback, there would be some error on the server (serving the rpc call) But in this case, the call went thru fine. No error on server.

So I started debugging. First place to look, check server logs. No error there. Added additional debug statements on server. Still no help.

Then I modified the client-side code. Checked if there were additional information in the response sent back. Nothing.

May be there was something wrong with this specific RPC. Just to isolate, I made another RPC, which was known to work at other places. I was so sure that problem would go away, that I was shocked that problem remained.

So clearly it wasn’t the RPC, but the way it was called. So I started looking at surrounding code. Wasn’t any different. So I went further up the stack. It turns out later in the chain – unconditional window.location.reload() was called. This was causing the browser to reload the page even before the jsonrpc would complete.

Looking back – it was obvious. So why did I write this post ? So that someone else who may come across such symptom in future, may have some tips to troubleshoot.

In case you are interested, this was part of this project

Enhanced by Zemanta

Installing gevent on shared hosting server

by Mandar Vaze on January 3, 2012
in Python, tips

Recently, I had to install “gevent” python module on webfaction. Normally, I would install it using “pip install gevent” – Very straight forward. But python gevent module requires libevent library, specifically the .so file. This file normally resides in /usr/lib, but on shared host you do not have permissions to write to this location, hence the normal method wouldn’t work.  The trick is to install the .so in custom location, but more importantly, ask pip to use this non-standard location using –install-option command line option

Here are the steps I followed :

wget https://github.com/downloads/libevent/libevent/libevent-1.4.13-stable.tar.gz
tar xvzf libevent-1.4.13-stable.tar.gz
mkdir ~/externals
cd libevent-1.4.13-stable
./configure –prefix=$HOME/externals/
make
make install
pip install –install-option=”-I$HOME/externals/include” –install-option=”-L$HOME/externals/lib” gevent
In the above steps $HOME is taken only as an example, feel free to install it at other locations, and pass the appropriate path to -I and -L as arguments.
While the example above talks about libevent, This method works well for other software as well.