DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Sync Block Diagnostics with PSSCor2 (or PSSCor4)

Sasha Goldshtein user avatar by
Sasha Goldshtein
·
Sep. 30, 12 · Interview
Like (0)
Save
Tweet
Share
3.50K Views

Join the DZone community and get the full member experience.

Join For Free

Alternative title: yet another another another way to determine the sync object for which your thread is waiting. I should make a series out of these posts, as there are at least four distinct approaches now.

In case you haven’t seen them, PSSCor2 and PSSCor4 are WinDbg extensions that augment and extend SOS functionality for .NET 2.0 and 4.0 applications, respectively. They don’t ship with the .NET Framework (unlike SOS), but you can find them online.

To the case in point, PSSCor2/4 provides a command called !SyncBlk (akin to SOS’s command with the same name), which outputs the list of threads waiting for each of the locked sync blocks in your program. This is a one-stop shop for all Monitor-related deadlock and wait chain diagnostics, out of the box.

Here’s an example from a 64-bit app (the command output was edited to fit the screen):

0:011> .load C:\…\psscor2\amd64\psscor2 
0:011> !syncblk 
Index  Owning Thread Info 
   18  00000000007f2e40  1da8   0    
         Waiting threads: 4 
   19  000000001bbe14a0  185c   4    
         Waiting threads: 0 
-----------------------------

The output immediately shows the locked sync blocks as well as the threads that are blocked waiting for them. Owning thread information provides the deadlocked wait chain immediately:

Thread 0 –> Sync Block 19 –> Thread 4 –> Sync Block 18 –> Thread 0

Sync (Unix) Blocks

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The 12 Biggest Android App Development Trends in 2023
  • Asynchronous HTTP Requests With RxJava
  • Hidden Classes in Java 15
  • Remote Debugging Dangers and Pitfalls

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: