• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Servlets and Sessions and Memoryleaks OH MY!

 
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay.. here's the gig..
I'm getting a memory leak somewhere in my application. After about 1.5 days my application starts to act odd and memory issues start showing up in the logs. So currently the environment is being reset at noon every night. My application uses servlets and sessions in it. Is there anything I should be watching out for in order to help the system release the objects for garbage collection? The session timeout is set to 1 hour right now.
My session questions are as follows:
Can a user create multiple sessions?
When an browser closes, does the session still exist?
Is there a way to check to see if the user is still on my web site or do I have to wait until the session is dead?

Are there any sites out there that can give me a good idea of what might be happening or any common probablems with sessions and servlets and memory leaks. Any help, questions or directions would help.
Again ,if you have questions, please feel free to post them. I'm looking for a direction and/ or brainstorming
Thanks

------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe the only way to create a new session is by opening another browser. In effect, it would be like another user. You can, however, open up multiple browsers using the same session by going to File, New, Window in the browser.
When the browser closes the session will still exist within the server until your session timeout time is reached. Maybe reducing this time will help! Note: A user should not be able to get the same session back upon re-opening a browser. So, if I were to go to your site and open and close browser windows to create the session then I could potentially have a lot of sessions remaining on your server.
I can't help with the last question. Sorry.
I hope I am correct with this. I would not want to lead you astray.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, sessions persist until they time out, and starting up a new browser will give you a new session. There are JavaScript-based workarounds for this, but none of them is perfect; cross-browser compatibility is a major pain. Besides, this is unlikely to be the root of your problem.
Based on what you say, it seems that something is leaking memory. Something is keeping references to obsolete objects, preventing them from being garbage collected. This "something" may be your application but it could conceivably also be an application server bug.
One way to find out more is to start java with -Xrunhprof:heap=all. This writes an overview of the heap to a file when you stop the JVM. It's huge, it's not pleasant, but it should show you what's clogging up the heap and put you on the right track. Maybe others can suggest tools that will help with this type of profiling.
- Peter
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah.. I figured it was something like that. The issue now becomes how to find it. Now here's the bad news. Its on the OS390. UGH!
Dale

------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
You can't expect to wield supreme executive power just because
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic