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
Partner Zones AWS Cloud
by AWS Developer Relations
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
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report

The Best Multi-Threading Debugging Tool in Microsoft Excel

Oren Eini user avatar by
Oren Eini
·
May. 10, 12 · Interview
Like (0)
Save
Tweet
Share
4.90K Views

Join the DZone community and get the full member experience.

Join For Free

in any system that gets to a certain size, especially one that is multi threaded, there are a certain class of bugs that are really a bitch to figure out.

they are usually boil down to some sort of a race condition. i have been doing that recently, trying to fix a bunch of race conditions in ravendb. the problem with race conditions is that they are incredibly hard to reproduce, and even when you can reproduce them, you can’t really debug them .

i came up with the following test harness to try to narrow things down . basically, create a test case that sometimes fails, and run it a thousand times.

odds are that you’ll get the failure, but that isn’t the important bit. the important bit is that you setup logging properly. in my case, i set things up so the logging output to csv and each test run had a different file.

this gives me output that looks like this:

23:54:34.5952,raven.database.server.httpserver,debug,request #  10: get     -    12 ms - <default>  - 200 - /indexes/dynamic/companies?query=&start=0&pagesize=1&aggregation=none,,11
23:54:34.5952,raven.client.document.sessionoperations.queryoperation,debug,"stale query results on non stale query '' on index 'dynamic/companies' in ' http://reduction:8079/' , query will be retried, index etag is: bcf0fed1-d975-43b4-bfb7-65221ef06b99",,1
23:54:34.5952,raven.database.indexing.workcontext,debug,"no work was found, workerworkcounter: 10, for: tasksexecuter, will wait for additional work",,6
23:54:34.5952,raven.database.indexing.workcontext,debug,incremented work counter to 11 because: work by indexingexecuter,,12
23:54:34.5952,raven.database.indexing.workcontext,debug,"no work was found, workerworkcounter: 11, for: tasksexecuter, will wait for additional work",,6
23:54:34.5952,raven.database.indexing.workcontext,debug,"no work was found, workerworkcounter: 11, for: reducingexecuter, will wait for additional work",,21
23:54:34.5952,raven.database.indexing.workcontext,debug,"no work was found, workerworkcounter: 11, for: indexingexecuter, will wait for additional work",,12
23:54:34.6952,raven.client.document.sessionoperations.queryoperation,debug,executing query '' on index 'dynamic/companies' in ' http://reduction:8079/',,1
23:54:34.8172,raven.database.indexing.index.querying,debug,issuing query on index temp/companies for all documents,,11
23:54:34.8172,raven.storage.esent.storageactions.documentstorageactions,debug,document with key 'companies/1' was found,,11

not really helpful in figure out what is going on, right? except for one tiny thing, we load them to excel, and we use conditional formatting to get things to look like this:

image

the reason this is so helpful? you can actually see the threads interleaving. this usually help me get to roughly the right place, and then i can add additional logging so i can figure out better what is actually going on.

i was able to detect and fix several race conditions using this approach.

and yes, i know that this is basically printf() debugging. but at least it is printf() debugging with pretty colors.

Microsoft Excel

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • gRPC on the Client Side
  • Java Concurrency: LockSupport
  • Tackling the Top 5 Kubernetes Debugging Challenges
  • MongoDB Time Series Benchmark and Review

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: