Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Java IoT, Weblogic, Containers Expo Blog, Recurring Revenue

Java IoT: Article

Dealing with Application Deadlocks

Detecting and reporting deadlocks with the WebLogic Server

The Jstack utility may also automatically detect deadlocks in the thread dump and display an output as follows :

Found one Java-level deadlock:

=============================
"Thread-1":
  waiting to lock monitor 0x02a6ee64 (object 0x229bd238, 
  a java.lang.Object), which is held by "Thread-0"
"Thread-0":
  waiting to lock monitor 0x02a6eecc (object 0x229bd240, 
  a java.lang.Object), which is held by "Thread-1"
 
Java stack information for the threads listed above:
===================================================
"Thread-1":
        at SimpleDeadLock$Thread2.run(SimpleDeadLock.java:37)
        - waiting to lock <0x229bd238> (a java.lang.Object)
        - locked <0x229bd240> (a java.lang.Object)
"Thread-0":
        at SimpleDeadLock$Thread1.run(SimpleDeadLock.java:24)
        - waiting to lock <0x229bd240> (a java.lang.Object)
        - locked <0x229bd238> (a java.lang.Object)
 
Found 1 deadlock.    

Once the thread dump has been acquired, you may use a thread dump analyzing tool to generate a report based on its contents.

Dealing with Deadlocks
Ultimately the deadlock must be cured by making changes to the piece of code where the threads continuously get stuck. However, since this may not be possible immediately in a production environment, the following are a few temporary measures one may take in order to deal with the issue:

  • Stuck Thread Reporting:
    WebLogic has the ability to identify and report stuck threads corresponding to a server and print the result in the logs to which the server output is redirected. A thread is diagnosed as stuck if it is continually working (not idle) for a set period of time. You may also configure certain parameters related to the stuck thread identification as follows :

Login to AdminConsole->Servers -> <server name> -> Tuning

a) configure ‘Stuck Thread Max Time'

Enter the number of seconds that a thread must be continually working before this server diagnoses the thread as being stuck. By default, WebLogic Server considers a thread to be "stuck" after 600 seconds of continuous use.

b) configure ‘Stuck Thread Timer Interval'

Enter the number of seconds after which WebLogic Server periodically scans threads to see if they have been continually working for the length of time specified by Stuck Thread Max Time. By default, WebLogic Server sets this interval to 600 seconds.

The output in the servers logs looks like the following:

<Feb 29, 2011 12:00:00 PM UTC> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: 'xx' for queue: 'WebLogic.kernel.Default (self-tuning)' has been busy for "xxx" seconds working on the request "xxxxxxxxxx" , which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:

An alarm may be configured to sniff the server logs at regular intervals and inform the concerned party when a certain number of stuck threads have been reported by WebLogic.

  • Stuck Thread Reaction:

At the server level:

Login to AdminConsole->Servers -> <server name> -> Overload

At the server level, the server's Overload Configuration tab controls its stuck thread behavior. ‘Max Stuck Thread Time' specifies the length of time after which the server considers a thread stuck. If ‘Stuck Thread Count' threads become stuck, the server transitions itself to a failed state. Once the server transitions to a failed state, the ‘Failure Action' parameter controls what action to take to correct the situation.

At the work manager level:
Work managers can define how they want to handle stuck threads. Work managers support defining stuck thread behavior using a shutdown trigger. A shutdown trigger tells the work manager that it should shut itself down if there are <stuck-thread-count> threads executing requests on its behalf that are stuck for longer than <max-stuck-thread-time> seconds. This work manager definition shown here tells the work manager to shutdown if 5 threads are stuck for more than 300 seconds.

<weblogic-enterprise-bean>
<ejb-name>MyEjb</ejb-name>
<dispatch-policy> MyStuckThreadWorkManager</dispatch-policy>

.................................................................................................................................................................................
</weblogic-enterprise-bean>

<work-manager>
<name>MyStuckThreadWorkManager</name>
<work-manager-shutdown-trigger>
<max-stuck-thread-time>300</max-stuck-thread-time>
<stuck-thread-count>5</stuck-thread-count>
</work-manager-shutdown-trigger>
</work-manager>

At the application level:
Enterprise applications support defining stuck thread behavior using an admin trigger. An admin trigger tells the server that it should transition the application into admin mode if there are <stuck-thread-count> threads executing requests on its behalf that are stuck for longer than <max-stuck-thread-time> seconds. One important difference about the application admin trigger is that it will automatically switch the application back from admin to running mode if the stuck thread condition clears. You define the admin trigger using the <application-admin-mode-trigger> element of the enterprise application's weblogic-application.xml deployment descriptor. The admin trigger definition shown here tells the server to put the application into admin mode if 5 threads are stuck for more than 300 seconds.

<application-admin-mode-trigger>
<max-stuck-thread-time>300</max-stuck-thread-time>
<stuck-thread-count>5</stuck-thread-count>
</application-admin-mode-trigger>

Summary
Applications freezing in the production environment on a regular basis can cause nightmares. The root cause many times can be deadlocks, which can be confirmed by analyzing the thread dump of an application that appears to be hung. The WebLogic server may be configured to detect and report these deadlocks in the logs as ‘stuck threads.' The WebLogic server also has the ability to take certain actions based on the detection of one or more stuck threads that can be configured at the server, work manager and application level.

More Stories By Sanat Vij

Sanat Vij is a professional software engineer currently working at CenturyLink. He has vast experience in developing high availability applications, configuring application servers, JVM profiling and memory management. He specializes in performance tuning of applications, reducing response times, and increasing stability.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lead...
SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
As businesses evolve, they need technology that is simple to help them succeed today and flexible enough to help them build for tomorrow. Chrome is fit for the workplace of the future — providing a secure, consistent user experience across a range of devices that can be used anywhere. In her session at 21st Cloud Expo, Vidya Nagarajan, a Senior Product Manager at Google, will take a look at various options as to how ChromeOS can be leveraged to interact with people on the devices, and formats th...
SYS-CON Events announced today that Yuasa System will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Yuasa System is introducing a multi-purpose endurance testing system for flexible displays, OLED devices, flexible substrates, flat cables, and films in smartphones, wearables, automobiles, and healthcare.
Organizations do not need a Big Data strategy; they need a business strategy that incorporates Big Data. Most organizations lack a road map for using Big Data to optimize key business processes, deliver a differentiated customer experience, or uncover new business opportunities. They do not understand what’s possible with respect to integrating Big Data into the business model.
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities – ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups. As a result, many firms employ new business models that place enormous impor...
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Taica manufacturers Alpha-GEL brand silicone components and materials, which maintain outstanding performance over a wide temperature range -40C to +200C. For more information, visit http://www.taica.co.jp/english/.
SYS-CON Events announced today that Dasher Technologies will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, will discuss how they b...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
SYS-CON Events announced today that TidalScale will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale is the leading provider of Software-Defined Servers that bring flexibility to modern data centers by right-sizing servers on the fly to fit any data set or workload. TidalScale’s award-winning inverse hypervisor technology combines multiple commodity servers (including their ass...
As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Amazon is pursuing new markets and disrupting industries at an incredible pace. Almost every industry seems to be in its crosshairs. Companies and industries that once thought they were safe are now worried about being “Amazoned.”. The new watch word should be “Be afraid. Be very afraid.” In his session 21st Cloud Expo, Chris Kocher, a co-founder of Grey Heron, will address questions such as: What new areas is Amazon disrupting? How are they doing this? Where are they likely to go? What are th...
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...