Skip to Content

Problem with implementing a timeoutpage

Hi,

I am trying to get a session timeoutpage working but there is one big problem. My setup is the following:

-For detecting the timeout and displaying the timeout page I followed Thomas Jungs weblog

(/people/thomas.jung3/blog/2004/12/06/bsp-developers-journal-part-xv--stateful-bsp-and-timeouts)

-For our session management I am using the new state managment option which Thomas Jung described (/people/thomas.jung3/blog/2004/11/09/updated-stateful-bsp-applications-new-state-management-option). Btw when I am using the old system-session_single_frame.htm the problem is there too.

So what's my problem? Check out the following procedure:

1) I open my bsp application and there is one http-session in the sm04.

2) Using sm04 I close this http-session.

3) I am doing a request in my bsp application and the timeoutpage is displayed.

4) After 4sec a javascript in the timeoutpage redirects me back to my bsp application.

5) Now the problem: Normally there should be one new session in the sm04 but I get <b>TWO</b>!!

6) When I close my browser one session will be closed and the other one remains open.

I spent the last two days with debugging and testing but I can't find the reason. Today I discovered that the two session only appear when I use:

a) A automatic redirect: window.setTimeout("top.document.location.href='<%= targetUrl %>';", 4000);

b) A link using the <htmlb:link/> tag

When I am using normal html code like <a href="<%= targetUrl %>"/> to get back to my application only one session will be created!

What can cause that the webserver opens two session instead of one?

Some more information. The timeoutpage is in a different bsp application which is stateless (like Thomas Jung suggested in the comments of his weblog). It's a MVC Application. We are using WAS 620 SP41

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 09, 2004 at 02:22 PM

    Wow what a brain teaser. I haven't been able to recreate the situation you describe in my system, so I have a few questions. You describe the outcome of the tree different reload ways. Are the results always consistent across multiple tests. The reason I ask is because if have an application that when launched, once in awhile creates two backend sessions (although the user only sees one). The only reason I know this is because I am locking a record on the application start and the user is getting an error message, because the record is locked in the first phantom session. Now this doesn't happen every time (nor does it happen often). I haven't been able to find the root cause. But it sounds like you are seeing predictable results.

    I'm really blown away by the fact that plain HTML works, but the window.setTimeout doesn't. I'm stumped as to what would be different about these two. What does your typical targetUrl look like? I assume you are loading through to the session management start page (which appears to be working because of the one session being cleaned up). I was getting double sessions at one point in an application when I reloaded it if the targetUrl contained the encoded information. If fixed this by including the sap-unique parameter to the reload url.

     currenttime = sy-uzeit.
        call method cl_http_server=>append_field_url
          exporting
            name  = 'sap-unique'
            value = currenttime
          changing
            url   = url.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 10, 2004 at 08:58 AM

    Yes the results are always consistent (I tested for two days). Hehe, you should have seen me when I realised that it worked when using plain html. I find a very strange either. Here my answers to your questions:

    I construct my targetUrl dynamically using 'http://' sy-host 'exampleurl.com' runtime->application_name.

    Yes I am loading through the session management start page (It's the default page in my mvc application).

    I don't think that there are any encoded infomation in my targetUrl but I will test your code on monday when I am back in the office. Btw what does the sap-unique parameter? I have never used it before.

    Anyway thanks for your reply.

    Add a comment
    10|10000 characters needed characters exceeded

    • I found the use of sap-unique in some SAP code. It was down in the Runtime object. I was having problems when I reloaded the same application, but a different page within that application. The old session was remaining. I added the sap-unique, then everything was fine. It's definetely a shot in the dark, but we are way out in left field on this one anyway.

  • Posted on Dec 13, 2004 at 09:07 AM

    Ok I added the sap-unique parameter and here are my results:

    1) I start the application. Of course the first url will not have the sap-unique parameter.

    2) I close my session the timeoutpage gets diplayed and after the redirect (url now has the sap-unique parameter) I get two sessions, again 😔

    3) Now I try it again close these two sessions, the timeoutpage gets displayed and it works! Only one session will be created. I tried it several times and always got the same results.

    It seems that when a session is created through the session management start page url which also has the sap unique parameter attached it always works. But the problem is that when a user launchs the application for the first time the url will not have the sap-unique parameter attached. A workaround would be that the user has to open the application by using a link on a website. Then I could attach the sap-unique parameter using javascript but that would be an evil hack 😉

    Seems that I have to rely on my own solution using the plain html link. Anyway thanks for your help.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.