Server timeout

Topics: Developer Forum
Developer
Aug 22, 2013 at 12:05 AM
How do I increase the server timeout? A couple of reports require very heavy data processing and it's timing out.
Coordinator
Aug 22, 2013 at 12:13 AM
Try:
oSession.timeout(14400) in the init

There may be a setting in web.config too.

Also to be considered is running as a background thread.
Developer
Aug 22, 2013 at 12:36 AM
‘........Also to be considered is running as a background thread........’

Yet more goodies to be uncovered.

And thanks.
Editor
Aug 22, 2013 at 1:25 AM
Also to be considered is running as a background thread.
Interesting timing because I've just finished watching an excellent presentation made last night and think it relates to this posting.

Please see the following link.
Video Presentation

Related White Paper and source code can be downloaded here

Or perhaps I've got the wrong end of the stick here Claude?
Even if I have, I'd still recommend all to watch this video anyway because of it's relevance to AVFP in general.
Developer
Aug 22, 2013 at 3:00 PM
My problem is the response timing out.

However, multithreading may be the better solution. My problem reports are with a blank template with nothing but 8px by 8px triple layered, image objects, placed side by side. Each image object is for showing a bmp file ( that does not exist at design time). During report runtime,, each of these image object reads the data from the server and creates it's own bmp file, dynamically, based on data found. This way, each img itself controls it's content(i.e. colored bmp picture ), size and transparency. I have no other external pre/post code. Just a dummy table in backround for report to loop.

Naturally with serial processing, it requires a large processing time in creating the report since each bmp is created pixel by pixle.

Im my estimate, the speed gain would be about 18,000 per cent if MT allows that manyn concurrent threads, which I doubt, but may be worth looking into. It is just an ole session object, so very similar to what I've done already in avfp.
Developer
Aug 22, 2013 at 3:12 PM
hi Simon,
that was a good link. thx fr sharing.
Jan 12 at 10:29 AM
I've the same problem with my web application. I stay for long times (40 minutes) on my web page, when i return on it and i click on confirm button, IIS tell me that there are errors in variables (because one or more variables that are initialized through form value).

I've tryed to set oSession.timeout in main.prg but nothing... I've tryed to set session expired times in IIS application, but nothing...

I don't think that Multi-Threading can be a solution for me, because i don't need to run another code but i want to have avaliable this code. How can i mantain the session lives without page refresh?
Coordinator
Jan 12 at 5:45 PM
Developer
Jan 14 at 6:40 PM
If its not a question of long response time from server itself, then another possible solution is to implement long pooling using ajax and Js setTimeout(). Make a lightweight call ( cookieless domain?),... and discard its return value (or show some message.. up to u) . The pooling timer can be triggered once every 10 minutes and it seems to work. The benefit of this approach (over IIS & ASP approach) is that you can control the poolinng activation and the timeout period, per AVFP page and the server load is low.

This solves the problem of users taking their own sweet time to fill out any lengthy form. (e.g. codeplex discussions hehe) However, if users desktop iteslf goes in sleep mode, due to user inactivity, then u still have a problem.
Jan 28 at 10:42 AM
claudefox wrote:
Probably setting in web.config:

http://stackoverflow.com/questions/6922571/what-is-the-difference-between-web-config-timeout-and-iis-timeout
I tried web.config but without results.


Titu1 wrote:
If its not a question of long response time from server itself, then another possible solution is to implement long pooling using ajax and Js setTimeout(). Make a lightweight call ( cookieless domain?),... and discard its return value (or show some message.. up to u) . The pooling timer can be triggered once every 10 minutes and it seems to work. The benefit of this approach (over IIS & ASP approach) is that you can control the poolinng activation and the timeout period, per AVFP page and the server load is low.

This solves the problem of users taking their own sweet time to fill out any lengthy form. (e.g. codeplex discussions hehe) However, if users desktop iteslf goes in sleep mode, due to user inactivity, then u still have a problem.
Can you give me an example? I don't know how i to do
Jan 28 at 10:43 AM
Edited Jan 28 at 10:44 AM
double post. sorry!
Developer
Feb 5 at 8:51 PM
Hi.. If this is still a problem... I am giving you the poll function....
Call it from the bottom of any avfp page. Itll be of help if you are using ajax and avfp Rest. Needs HTML 5. I had to strip out some stuff to make it simple so its not 'tested'. I use mixed case for code... from VFP days.. u may like to stick to lower case..
Good luck.
var pollsession= function() {

    var timerID;
    var pollSessionIsStopped;
    var pollSessionInterval;

    // Clear the previous timer if any
    timerID = localStorage.getItem('polltimerID');
    if (!(timerID == null) && (timerID.length > 0)) {
        clearTimeout(timerID);
    };
    pollSessionIsStopped = sessionStorage.getItem('pollSessionIsStopped');
    if (!(pollSessionIsStopped == null) && (pollSessionIsStopped.length > 0)) {
        if (pollSessionIsStopped == "yes") {
            return;
        };
    };
    // Chk the timer interval... use it to set the pooling interval for any page by setting the pollSessionInterval value on page init(). To stop set the 'pollSessionIsStopped' property.
    pollSessionInterval = sessionStorage.getItem('pollSessionInterval');
    if (!(pollSessionInterval == null) && (pollSessionInterval.length > 0)) {
        // this is OK..
    }
    else {
        pollSessionInterval = 10000
    };


    // Now Create a new Timer
    timerID = setTimeout(function () {
        var thispage = $.mobile.pageContainer.pagecontainer('getActivePage');
        var newHtml = <<your restfull URL>>;
        var data = [];
        var name = "QueryDataBase";
        var value='no';
        data.push({ name: name, value: value });
        $.ajax({
            url: newHtml,
            type: 'post',
            data: data,
            complete: pollsession,
            success: function (data, error) {
                var isErr = false;
                try {
                    var odata = JSON.parse(data);
                } catch (err) {
                    isErr = true;
                };

                if (isErr == true) {
                    return;
                };
                // first set the value of pollSessionIsStopped if u have stored it as a flag it in any database table
                if (odata.pollsessionisstopped == 'yes') {
                    // this will stop the timer for the remaining part of this user session
                    sessionStorage.setItem('pollSessionIsStopped','yes');
                };
               
                // update anything u want here
            },
            error: function (data, error) {
                // In case we hit any Error.. then this will stop the timer for the remaining part of this user session
                sessionStorage.setItem('pollSessionIsStopped', 'yes');
            }
        });
    }, pollSessionInterval);
    localStorage.setItem('polltimerID', timerID);
};