cancel
Showing results for 
Search instead for 
Did you mean: 

400 Session Timeout and Memory bottleneck

Former Member
0 Kudos

Hi All,

I am using a BSP application linked to an ITS. After few sessions(say 25)

I get an error "<b>New session was refused due to memory bottleneck</b>" . BASIS

team has increased the memory by setting the parameter, em/global_area_MB = 400 MB. And now the error occurs again but after many sessions (say 130).

We tried to set the session timeout = 3mins(default is 30 mins) in SICF transaction to kill the session,so that we don't get the memory bottleneck issue, By doing this, I frequently get an error of "<b>400 Session timed out - please log in again</b>" if the session is idle for 3 mins.

Can anyone tell me what has to be done, so that I don't get both the errors, Can I kill the session programmatically?

Thanks for your help in advance.

Regards,

Sameena.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sameena,

one possible solution is to make your application stateless. In that case the memory is only allocated during handling of the request/response on the Appserver. Of course this is a little more tricky to program especialy if it is a bigger application.

So if you want to stay statefull I'd suggest that you create a page called default.htm that contains a javascript for the onunload event of the body tag. This javascript forces a request to the WebAS and kills the session. The page could look similar to this:

<%@page language="abap" otrTrim="TRUE"%>
<%@extension name="htmlb" prefix="htmlb"%>
<%@ extension name="phtmlb" prefix="phtmlb" %>
<%@ extension name="xhtmlb" prefix="xhtmlb" %>
<%@ extension name="bsp" prefix="bsp" %>
<htmlb:content design="design2003" controlRendering="SAP" forceEncode="ENABLED">
<htmlb:document>
<htmlb:documentHead title="My Test App">
<%-- insert header includes here, e.g. for external references to javascript library if required --%>
<htmlb:headInclude />
<script language="JavaScript">
<%-- "Javascript-Function is called in the bee-object --%>
<!--
var strClosed="NO";
function CloseSession()
{
if(strClosed=="NO")
  {
    var objImg = new Image;
    objImg.src = window.location.protocol + "//" + window.location.hostname + window.location.pathname + "/1x1.gif" + "?sap-contextid=<%= cl_http_utility=>escape_url( runtime->session_id )%>" + "&sap-sessioncmd=CANCEL";
    var stop = (new Date()).getTime() + 500;
    while((new Date()).getTime() < stop)
      for(e in document.all) tmp=e.innerHTML;
  }
}
//-->
</script>
</htmlb:documentHead>
<htmlb:documentBody attributeBee="<%=gr_bee%>" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" reposition="FALSE" scrolling="NO">
  <iframe id="IframeRoot" src="<start_page_of_bsp_app>" style="margin:0px; height:100%; width:100%" scrolling="no">
</htmlb:documentBody>
</htmlb:document>
</htmlb:content>

where <start_page_of_bsp_app> is the real page of your BSP-application and gr_bee is a reference to a class implementing the interface IF_BSP_BEE. In this class the method if_bsp_bee~render_to_string contains the following line:

result = 'onunload="CloseSession();"'.

What does this page?

Once you close the browser or navigate away from default.htm a request is sent to the WebAS with the command to cancel your session. This will not prevent the error message from coming up once you have reached a cretain number of concurrent sessions but it will avoid most of the orphaned sessions that still allocate memory. Please be aware that it most probably has not a success rate in killing the session of 100% as things like browser crashes prevent this final request from beeing executed.

Hope that helps.

Best Regards

Michael