Author Topic: Application timing out while sitting on a FreeMarker page  (Read 13533 times)

kdiamond

  • Customer
  • Jr. Member
  • *
  • Posts: 53
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #15 on: February 17, 2012, 10:05:28 AM »
Yes, we are sure we are getting pings from the script -- but only for 1 minute.  We have made the corrections that you suggested, but our results are still the same -- pinging only occurs for one minute.  In the attached zip you will see the "CorrectedPageSource.htm" with the corrections you suggested.  You can also see an excerpt from our web server debug printing ("DebugExcerpt.txt") which shows the KeepAlives every 10 seconds after we enter the FreeMarker page (see "Going FreeMarker..." in debug).  But, after 1 minute, the pings just stop.

Dev Team

  • Customer
  • Hero Member
  • *
  • Posts: 593
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #16 on: February 17, 2012, 02:06:47 PM »
Hosted our page on local server, we're getting 20+ ping requests both Firefox 9.0.1 and Chrome 17.0.963.46 and it still works (even if switch tabs).

Since you page doesn't seem to have any other complex functionality, it might be:
1) JavaScript error somewhere on page, check if firefox displays any error message, FireBug might help
2) Check you server answers, maybe server replied to ping request with some non-valid response which caused error in JQuery
3) Check on clean firefox, maybe you have some addons that breaks ping requests (or tries to "optimize" them stopping setInterval after a minute)

Since we can't reproduce it in our env, we would need more info from your, or remote access.

The easiest way to debug this would be to install FireBug in your Firefox, go to this page, open "Net" tab, see that request is sent every 10 seconds, maybe it doesn't stop after that, then the problem is on server tab. If it stops - open last server response, you can do it with FireBug, see if it's different from others, see "Console" and "Scripts" tabs for errors in JavaScript.

kdiamond

  • Customer
  • Jr. Member
  • *
  • Posts: 53
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #17 on: February 21, 2012, 04:38:59 PM »
We have installed FireBug and studied this problem in detail.  We have observed that the browser is continuing to send the pings, but the 200 OK response is not being sent.  We cannot, however, see why this is happening.   Since you have our product, would you please test it on your end against the latest version of VLTrader (version 4.4) and let us know what you see?  If you need directions on testing VLPortal within VLTrader, please let me know and I'll send them to you. 

Thank you.

Dev Team

  • Customer
  • Hero Member
  • *
  • Posts: 593
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #18 on: February 21, 2012, 06:47:16 PM »
Do we understand correct:
1) When browser submits pings from AjaxSwing page, it always replies with 200 ok and session keep alive works.
2) When pings sent from FreeMarker page, server replies with 200 ok, but after 60 seconds server stops to respond (or does it reply with error?).

Few more questions:
1) If you refresh page after server stops to reply - do you get session expired? Or it continues to work and again stops after 60 seconds?
2) Do you know of any configuration used in VLTrader that correlates with 60 seconds?
3) Any errors in logs you were able to see?
4) How do we get to this FreeMarker page from existing VLTrader installation?

Also how did this issue begin, was it working correctly and then stopped at some point, or you're not sure and it could be broken from the start?

We will start trying to reproduce it in our env from tomorrow, but answers on question from this post might help us a lot to identify root cause for this defect.

kdiamond

  • Customer
  • Jr. Member
  • *
  • Posts: 53
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #19 on: February 22, 2012, 05:48:38 PM »
We need to redirect this conversation because we think have found the cause of the problem.   However, we still would like to run this by you since the original suggestion originated from CreamTec, and we want to be sure that we are not circumventing any plan you had.

First, the root cause of the problem was due to the fact that the GET request, as part of a POST/REDIRECT/GET(PRG) pattern, contained a header of "Content-Type: application/x-www-form-urlencoded"... but there was no content.  This caused our web server to hang on the read to the socket, ultimately causing the pinging process to fail.   Backing up from there...what we discovered was that this errant header was most likely present because the original POST contained this header, and the original POST contained it because the Javascript contained code to pass data of "keepSessionAlive=true".  See original Javascript below.

function pingAjaxSwingSession() {
    var options = {};
    options.url = "${ajaxSwingUrl}?reportName=KeepAlive";
    options.type = "POST";
    var data = {};
    data.keepSessionAlive = true;
    options.data = data;
    options.global = false;
    options.success = processAjaxResponse;
    options.complete = onAjaxComplete;
   $.ajax(options);
  }

Our solution was to remove the three line pertaining to "keepSessionAlive=true", yielding the following function.

function pingAjaxSwingSession() {
    var options = {};
    options.url = "${ajaxSwingUrl}?reportName=KeepAlive";
    options.type = "POST";
    options.global = false;
    options.success = processAjaxResponse;
    options.complete = onAjaxComplete;
   $.ajax(options);
  }

This method works now for both Firefox 3.x and 9 and 10.  So here are our questions to you.

1.  What was the original reason for passing "keepSessionAlive=true" in the POST because it doesn't seem to be used?
2.  Do you see any potential problems with our solution?

Thanks!

kdiamond

  • Customer
  • Jr. Member
  • *
  • Posts: 53
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #20 on: February 29, 2012, 06:14:31 PM »
Just following up and wondering if you had a chance to review our previous post.

Thanks!

Dev Team

  • Customer
  • Hero Member
  • *
  • Posts: 593
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #21 on: March 01, 2012, 12:24:50 PM »
You solution should work without any problems.

AjaxSwing reads keepSessionAlive value on server during request processing, using following code:
Code: [Select]
String keepSessionAlive = getParameterValue(request, "keepSessionAlive");
if (!"false".equals(keepSessionAlive)) {

So unless you specify keepSessionAlive as "false" (and in your case it would be NULL) - it should work correctly.

kdiamond

  • Customer
  • Jr. Member
  • *
  • Posts: 53
    • View Profile
Re: Application timing out while sitting on a FreeMarker page
« Reply #22 on: March 05, 2012, 10:00:50 AM »
Okay...thank you!