Results 1 to 7 of 7

Thread: Application hangs for no apparent reason

  1. #1

    Default Application hangs for no apparent reason

    I'm new to Spring so forgive me if this is a completely ignorant question.

    I've been developing a blog application to practice using Spring and Hibernate. I've noticed that as a click around my application, after about 8 - 10 link clicks, my application will hang. I don't get any errors, no exceptions pop up in my debugger and there doesn't appear to be anything telling in my Spring log files. I've tried to step through my code as well and there doesn't seem to be any point in my code that my IDE chokes on. The application will just sit there trying to load the next page forever.

    Are there any other logs/places I can check to see what's going on besides what I already tried? I'm using Tomcat as my web container. To be honest, I'm not even sure if this a Spring problem, but this seemed as good as any place to post seeing how I don't have a clue what the issue is.

    Thanks in advance!

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Judging by the behavior you have a misconfigured transaction setup (or no transactions at all) leaving connections open and depleting your connection pool.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    Thanks for the suggestion!

    I had considered that, but I'm surprised that if there was a pooling issue that an exception wouldn't get thrown. Also, just out of curiosity, even if I didn't have pooled connections, wouldn't the one connection that's available be freed and available after each database call? I would think that my application would hang momentarily while the connection is being used and then continue on after all the database calls have completed (basically, the one connection would just act as a bottle neck).

    Thanks again! I'll investigate and let you know what I find.

    Quote Originally Posted by Marten Deinum View Post
    Judging by the behavior you have a misconfigured transaction setup (or no transactions at all) leaving connections open and depleting your connection pool.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Not without proper tx setup... Imagine a pool with 10 connecetions and you don't tell your application where to release the connection (in this case hibernate session which also uses a connection) it will then simply wait until it times out, during the wait the connection is still checked out and unavailable for other threads... So after 10 threads (in a web environment generally 1 thread per request) your application would hang on getting a connection from the pool.

    An exception will be thrown after a certain time (not sure if there are defaults) the connection cannot be acquired.

    If you need some help/advice post code and configuration (when doing so use the [ code][/code ] tags).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5

    Default

    So I just got home and checked my setup. You were absolutely correct!

    I laughed at these...

    "I've noticed that as a click around my application, after about 8 - 10 link clicks, my application will hang"
    I had my pool set up for 8 max active connections.

    "The application will just sit there trying to load the next page forever"
    The default timeout (which I was using) is infinite.

    I changed my default timeout to 500ms and then I started getting exceptions about my connection. I'm going to try and add in a TransactionManager to try and resolve this issue. Thanks so much for your help!!

  6. #6

    Default

    Marten thanks so much for your help!! I got transaction management working (with only moderate pain) and now the connection pool seems to working appropriately.

  7. #7
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    I really must be doing this for too long. Reading a description like yours and directly think transaction setup... Maybe time for a career switch .
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •