Debug an Ajax Request

87 views
Skip to first unread message

Torsten Uhlmann

unread,
Apr 2, 2012, 10:40:34 AM4/2/12
to lif...@googlegroups.com
Hi,

we currently have a small issue in our application in IE9 that in some cases one function GUID is creating ajax requests over and over.

The sent function GUID is the same within one request and the answer content from the server is empty. We set the ajax retry count to 1, this request happens much more often.

Can you give me a pointer how I can debug this problem, basically find out which part of the code triggers this or which function is about to be executed...

My only idea right now would be to hack AFuncHolder and generate a stack trace for every executed function, but I hope there's a better way.

Thanks so much for your help!
Torsten.

Jeppe Nejsum Madsen

unread,
Apr 2, 2012, 11:09:11 AM4/2/12
to lif...@googlegroups.com
On Mon, Apr 2, 2012 at 4:40 PM, Torsten Uhlmann <T.Uh...@agynamix.de> wrote:
> Hi,
>
> we currently have a small issue in our application in IE9 that in some cases
> one function GUID is creating ajax requests over and over.

I don't really understand what the problem is here?

> The sent function GUID is the same within one request and the answer content
> from the server is empty. We set the ajax retry count to 1, this request
> happens much more often.
>
> Can you give me a pointer how I can debug this problem, basically find out
> which part of the code triggers this or which function is about to be
> executed...
>
> My only idea right now would be to hack AFuncHolder and generate a stack
> trace for every executed function, but I hope there's a better way.

Not sure how to debug this, but if the server sends an empty response
for a specific guid, it usually means the function attached to the
guid has been garbage collected.

What version of Lift are you using? There was this issue a while back,
which is now fixed: https://github.com/lift/framework/issues/1193

/Jeppe

AGYNAMIX Torsten Uhlmann

unread,
Apr 2, 2012, 11:27:30 AM4/2/12
to lif...@googlegroups.com
Hi Jeppe,

Am 02.04.2012 um 17:09 schrieb Jeppe Nejsum Madsen:

> On Mon, Apr 2, 2012 at 4:40 PM, Torsten Uhlmann <T.Uh...@agynamix.de> wrote:
>> Hi,
>>
>> we currently have a small issue in our application in IE9 that in some cases
>> one function GUID is creating ajax requests over and over.
>
> I don't really understand what the problem is here?

The problem is that this is a problem that only occurs on IE9. It just should not happen that this function is called that often. And it only occurs on IE9, not Chrome or Firefox.

>
>> The sent function GUID is the same within one request and the answer content
>> from the server is empty. We set the ajax retry count to 1, this request
>> happens much more often.
>>
>> Can you give me a pointer how I can debug this problem, basically find out
>> which part of the code triggers this or which function is about to be
>> executed...
>>
>> My only idea right now would be to hack AFuncHolder and generate a stack
>> trace for every executed function, but I hope there's a better way.
>
> Not sure how to debug this, but if the server sends an empty response
> for a specific guid, it usually means the function attached to the
> guid has been garbage collected.
>
> What version of Lift are you using? There was this issue a while back,
> which is now fixed: https://github.com/lift/framework/issues/1193

We use a quiet recent snapshot from about 2 weeks ago, so according to the git log this should be in (we will check).
But the problem occurs right after login, on the first page requested after login, after the session is created. I doubt that the garbage collector would chime in so fast?

Thanks,
Torsten.

>
> /Jeppe
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Jeppe Nejsum Madsen

unread,
Apr 3, 2012, 3:20:52 AM4/3/12
to lif...@googlegroups.com
AGYNAMIX Torsten Uhlmann <T.Uh...@agynamix.de> writes:

> Hi Jeppe,
>
> Am 02.04.2012 um 17:09 schrieb Jeppe Nejsum Madsen:
>
>> On Mon, Apr 2, 2012 at 4:40 PM, Torsten Uhlmann <T.Uh...@agynamix.de> wrote:
>>> Hi,
>>>
>>> we currently have a small issue in our application in IE9 that in some cases
>>> one function GUID is creating ajax requests over and over.
>>
>> I don't really understand what the problem is here?
>
> The problem is that this is a problem that only occurs on IE9. It just should not happen that this function is called that often. And it only occurs on IE9, not Chrome or Firefox.

Perhaps I'm being dense but I still don't really know what the problem
is? When you say function do you mean a js function, Lift function?

Perhaps you need to describe in a little more detail what you are seeing
(or even better, make a sample project demonstrating the problem)

[...]

> We use a quiet recent snapshot from about 2 weeks ago, so according to the git log this should be in (we will check).
> But the problem occurs right after login, on the first page requested after login, after the session is created. I doubt that the garbage collector would chime in so fast?

Agreed, that doesn't sound like a GC problem. The other thing to check
is to look at the http requests from the client. Do they send the
correct session cookie? If not, the server cannot find the session and
thus map the guid to a function

/Jeppe

Andreas Joseph Krogh

unread,
Apr 3, 2012, 3:31:38 AM4/3/12
to lif...@googlegroups.com

My guess is that the AJAX-request results in a JS-error which makes Lift
retry the request 3 (default) times and that's why your function is
executed 3 times (a guess), before Lift gives up. Try to grab the
returned JS and execute it and see if it results in an error.

Maybe decent exception-handling is in order?

--
Andreas Joseph Krogh<and...@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CEO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

AGYNAMIX Torsten Uhlmann

unread,
Apr 3, 2012, 8:38:33 AM4/3/12
to lif...@googlegroups.com
Hi Andreas,

we set the retry count for failed Ajax requests to 1, although the returned result from the server for this ajax request is plain empty, nothing in there. No JavaScript that could be failing.
These ajax requests happen very fast one after the other, 50 times and more. It's always the same function ID that is sent in the ajax_request.

Oh, and it only happens in IE8 and IE9, not in any other browser and also not in IE10 (Windows 8 Preview)…

@Jeppe: I've checked the Cookie header and it shows that the same JSESSIONID is sent as in the successful requests.

Thanks,
Torsten.

Jeppe Nejsum Madsen

unread,
Apr 3, 2012, 8:42:25 AM4/3/12
to lif...@googlegroups.com
On Tue, Apr 3, 2012 at 2:38 PM, AGYNAMIX Torsten Uhlmann
<T.Uh...@agynamix.de> wrote:
> Hi Andreas,
>
> we set the retry count for failed Ajax requests to 1, although the returned
> result from the server for this ajax request is plain empty, nothing in
> there. No JavaScript that could be failing.
> These ajax requests happen very fast one after the other, 50 times and more.
> It's always the same function ID that is sent in the ajax_request.
>
> Oh, and it only happens in IE8 and IE9, not in any other browser and also
> not in IE10 (Windows 8 Preview)…
>
> @Jeppe: I've checked the Cookie header and it shows that the same JSESSIONID
> is sent as in the successful requests.

Ok, two things that are strange:

1) The rapid rate of calls
2) The calls are not mapped on the server

How are the calls triggered? You could set a breakpoint in liftajax.js
and probably see why it is looping....

/Jeppe

Andreas Joseph Krogh

unread,
Apr 3, 2012, 9:07:42 AM4/3/12
to lif...@googlegroups.com
On 04/03/2012 02:38 PM, AGYNAMIX Torsten Uhlmann wrote:
> Hi Andreas,
>
> we set the retry count for failed Ajax requests to 1, although the
> returned result from the server for this ajax request is plain empty,
> nothing in there. No JavaScript that could be failing.
> These ajax requests happen very fast one after the other, 50 times and
> more. It's always the same function ID that is sent in the ajax_request.
>
> Oh, and it only happens in IE8 and IE9, not in any other browser and
> also not in IE10 (Windows 8 Preview)�

>
> @Jeppe: I've checked the Cookie header and it shows that the same
> JSESSIONID is sent as in the successful requests.
>
> Thanks,
> Torsten.

You're saying: "...we currently have a small issue in our application in
IE9 that *in some cases* one function GUID is creating ajax requests
over and over.". In what cases? Is it related to a server-restart?

AGYNAMIX Torsten Uhlmann

unread,
Apr 3, 2012, 9:28:46 AM4/3/12
to lif...@googlegroups.com
Andreas,

the problem occurs on one specific page of our application (if you're interested go to sgrouples.com, register a free account, create 2 groups, then you see a menu button "Worldview"- that's the one). On this page we can ajax load different content, and the problem only occurs when I load the "WhatsNew" content. It will load the content, but after the content is fully loaded, the ajax spinner still indicates an ongoing process and in the network log you see the large amount of requests fired.

@Jeppe: I'm diving into liftAjax.js to start some debugging…

Thanks,
Torsten.

Am 03.04.2012 um 15:07 schrieb Andreas Joseph Krogh:

> On 04/03/2012 02:38 PM, AGYNAMIX Torsten Uhlmann wrote:
>> Hi Andreas,
>>
>> we set the retry count for failed Ajax requests to 1, although the returned result from the server for this ajax request is plain empty, nothing in there. No JavaScript that could be failing.
>> These ajax requests happen very fast one after the other, 50 times and more. It's always the same function ID that is sent in the ajax_request.
>>

>> Oh, and it only happens in IE8 and IE9, not in any other browser and also not in IE10 (Windows 8 Preview)…


>>
>> @Jeppe: I've checked the Cookie header and it shows that the same JSESSIONID is sent as in the successful requests.
>>
>> Thanks,
>> Torsten.
>
> You're saying: "...we currently have a small issue in our application in IE9 that *in some cases* one function GUID is creating ajax requests over and over.". In what cases? Is it related to a server-restart?
>
> --
> Andreas Joseph Krogh<and...@officenet.no> - mob: +47 909 56 963
> Senior Software Developer / CEO - OfficeNet AS - http://www.officenet.no
> Public key: http://home.officenet.no/~andreak/public_key.asc
>

AGYNAMIX Torsten Uhlmann

unread,
Apr 3, 2012, 10:52:52 AM4/3/12
to lif...@googlegroups.com
I found the problem. I'm just not sure why this is a problem :)

The function ID that is sent to the server comes from an ajaxTextArea field that we generate into the html.

ajaxTextarea generates an "onblur" handler, that is the one the ID comes from. I have commented out the generated textarea and it works in IE9…

So some combination of settings/elements must trigger the onblur handler on IE9 constantly…

Thanks for your help and suggestions! They led me onto the right path to find the connection between ID and markup.

Torsten.

-- 
AGYNAMIX(R). Passionate Software.
Inh. Torsten Uhlmann | Buchenweg 5 | 09380 Thalheim
Phone:       +49 3721 273445
Fax:             +49 3721 273446
Mobile:       +49 151 12412427
Web:           http://www.agynamix.de

Am 03.04.2012 um 15:07 schrieb Andreas Joseph Krogh:

On 04/03/2012 02:38 PM, AGYNAMIX Torsten Uhlmann wrote:
Hi Andreas,

we set the retry count for failed Ajax requests to 1, although the returned result from the server for this ajax request is plain empty, nothing in there. No JavaScript that could be failing.
These ajax requests happen very fast one after the other, 50 times and more. It's always the same function ID that is sent in the ajax_request.

Oh, and it only happens in IE8 and IE9, not in any other browser and also not in IE10 (Windows 8 Preview)…

@Jeppe: I've checked the Cookie header and it shows that the same JSESSIONID is sent as in the successful requests.

Thanks,
Torsten.

You're saying: "...we currently have a small issue in our application in IE9 that *in some cases* one function GUID is creating ajax requests over and over.". In what cases? Is it related to a server-restart?

--
Andreas Joseph Krogh<and...@officenet.no>  - mob: +47 909 56 963
Senior Software Developer / CEO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

Andreas Joseph Krogh

unread,
Apr 3, 2012, 12:18:46 PM4/3/12
to lif...@googlegroups.com
On 04/03/2012 04:52 PM, AGYNAMIX Torsten Uhlmann wrote:
> I found the problem. I'm just not sure why this is a problem :)
>
> The function ID that is sent to the server comes from an ajaxTextArea
> field that we generate into the html.
>
> ajaxTextarea generates an "onblur" handler, that is the one the ID
> comes from. I have commented out the generated textarea and it works
> in IE9�

>
> So some combination of settings/elements must trigger the onblur
> handler on IE9 constantly�

>
> Thanks for your help and suggestions! They led me onto the right path
> to find the connection between ID and markup.

I think I've seen this kind of problem once where we used SHtml.*memoize
and re-rendered parts of the DOM with input-elements where one element
got focus and had onblur and then lost focus again. The onblur event
caused a JS-function to trigger which trigger re-rendering and we got
into a nasty loop.

AGYNAMIX Torsten Uhlmann

unread,
Apr 3, 2012, 3:46:02 PM4/3/12
to lif...@googlegroups.com
It turns out we used some workaround solution for placeholder tags in IE9, and this solution probably caused the onblur triggering, and then probably a loop like you describe got into play and caused that many ajax_request calls.

Thanks for your help,
Torsten.

Am 03.04.2012 um 18:18 schrieb Andreas Joseph Krogh:

> On 04/03/2012 04:52 PM, AGYNAMIX Torsten Uhlmann wrote:
>> I found the problem. I'm just not sure why this is a problem :)
>>
>> The function ID that is sent to the server comes from an ajaxTextArea field that we generate into the html.
>>

>> ajaxTextarea generates an "onblur" handler, that is the one the ID comes from. I have commented out the generated textarea and it works in IE9…
>>
>> So some combination of settings/elements must trigger the onblur handler on IE9 constantly…


>>
>> Thanks for your help and suggestions! They led me onto the right path to find the connection between ID and markup.
>
> I think I've seen this kind of problem once where we used SHtml.*memoize and re-rendered parts of the DOM with input-elements where one element got focus and had onblur and then lost focus again. The onblur event caused a JS-function to trigger which trigger re-rendering and we got into a nasty loop.
>
> --
> Andreas Joseph Krogh<and...@officenet.no> - mob: +47 909 56 963
> Senior Software Developer / CEO - OfficeNet AS - http://www.officenet.no
> Public key: http://home.officenet.no/~andreak/public_key.asc
>

Reply all
Reply to author
Forward
0 new messages