The Top 3 Reasons an Application Hangs

Spread the love

An application seemingly works great, and then all of a sudden, without any apparent cause, it hangs. You reboot the application and it seems to fix the problem. Another few days or even weeks pass and the application hangs again. Each time the application is not failing or crashing, it’s simply unresponsive. Sound familiar? If you have been in the IT industry long enough, these mystery freezes are a problem you likely know well, regardless of the application server.

Reasons an Application Hangs

The Top 3 Reasons an Application Hangs

Here are the top 3 reasons why an application server hangs:

Reason #1: It’s a Database Problem

As it turns out, the predominant factor which causes an application sever to hang is actually not directly connected to the application server itself. In fact, the following sequence is very common:
There isn’t enough data handling capacity to handle the current volume of traffic, causing the database to bottleneck and queries to run slower than usual.
Requests that generally take 1 second, now take 5 seconds to complete.
Due to the backlog, the average number of concurrent requests slowly increases.
The server runs out of threads and the application server hangs.
If you generate a thread dump of the JVM, you’ll notice many threads waiting and another group that’s actually running. Alternatively, the number of queued threads will use up all available memory and, eventually, lead to an OutOfMemory error.

Reason #2: Deadlocks.

If it seems that the application server is not doing anything, look for deadlocks in the database. This is a problem that results when two or more separate database sessions have some locked data, and each database session requests a lock on the data that a different session has locked already. Since the sessions are waiting indefinitely for each other, the application just hangs. These can be database deadlocks that cause your SQL queries to hang, or seek the update statements. For example, a transaction log that is written to the database for each request may easily hang the entire application if the log table is locked. It can also be a deadlock of the application re-accessing itself.

Reason #3: Run-Away Thread

In some cases, the application server is the source of the problem. Try searching for a run-away thread which will consume a lot of CPU for no real benefit. These are difficult to detect because a run away thread is often only written after the request has completed and, hence, will probably not return until it has already affected the entire application. Therefore, the hanging request will not be written to the log. A common cause is when a thread ends up in a tight processing loop due to a bug in the code. For example, a query that should show results that does not include the option of paging between result pages suddenly needs to display a large number of results. The page takes a long time to render and affects the application server, eventually causing it to hang.

Stopping the Application Hang-Ups

End-user monitoring and real-time transaction management solutions, such as SharePath by Correlsense, help to pinpoint the reasons for an application hang by providing a real-time view into the entire application behavior. In fact, SharePath is the only single solution on the market today that can provide true end-to-end transaction monitoring. From the moment a user clicks any button in a monitored desktop or Web-based application, SharePath monitors the transaction through the entire infrastructure, through proxies, Web servers, load balancers, application servers, message brokers, databases and mainframes.