Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8748115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:28:10+00:00 2026-06-13T12:28:10+00:00

I am learning about the Java EE HttpSession (in Tomcat). It says that when

  • 0

I am learning about the Java EE HttpSession (in Tomcat). It says that when we close the browser, the cookie JSessionID=12345 will be destroyed (but on the server side, a session object still retain until its lifespan ends).

Let’s say we set the session lifespan to be one hour. There is a kind of scenario that a user repeats the following action:

  1. access servlet (and this servlet calls getSession())

  2. close browser (or clear cookie).

So this repetition will cause a lot of useless session objects to be created, and they will only be destroyed after their lifespan ends.

In this case, some ‘hacker’ will be able to write a program to exploit our server (keep on creating session objects until we run out of RAM). Will this scenario be possible in a real environment? Does Java EE do anything to prevent this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:28:11+00:00Added an answer on June 13, 2026 at 12:28 pm

    Yes, that is definitively a real life scenario. I know cases where search engines killed web sites by crawling the site, because they created a new huge session on each request.

    I guess there are only two ways to handle this:

    • Keep the session lifetime as short as possible.
    • Prevent the use of the session to store huge objects.

    I generally prefer the latter one. IMHO there are very few cases where you REALLY need to store huge objects in the session.

    This is also what you will lean in books like Release it by Michael T. Nygard (very good book by the way).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anything that java cannot do? But other's can? I am talking about
hi i am learning about Java interfaces. I read in Java tutorial that an
I'm learning about Lists in java but I'm having a hard time returning it
I am learning JAVA myself and I am learning about memoization now. But i
I'm learning about Java enums and I was wondering what is the best approach
I've just started learning Java (about a week ago) and the last few days
First of all, my ubiquitous language is PHP, and I'm thinking about learning Java.
in my java class we were learning about arrays and this question came up.
I am learning about the Runtime class in java, and am testing the use
I am currently learning about basic networking in java. I have been playing around

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.