Rise of the Heisenbug

Post on 11-May-2015

1,486 views 4 download

Tags:

description

Gil Zilberfeld's presentation from ADC2011 on identifying and preventing multithreading issues.

transcript

Veranstalter:

Speziell zu Software-Testing14.-15. Februar 2011, München

Rise of the HeisenbugGil Zilberfeld

Who Am I?

• Software developer for 15 years

• Product Manager at Typemock

• @gil_zilberfeld

• www.gilzilberfeld.com

What’s the plan?

• A humble beginning• Heisenbugs• Tools and solutions

My First TDD Project

Progress has beaten us

• The Multicore• Mainstream

Languages don’t help• Tools are complex

We can do so much more

Concurrency problems

• State problems• Race conditions• Deadlocks

Heisenberg’s Uncertainty Principle

It is impossible to know both the exact position and the exact velocity of an object at the same time

Heisenbug

The process of hunting the bug impacts our ability to catch it

Heisenbugs

• Identification is hard• Reproduction is

hard• Fixing is easy• Checking the fix is

hard

A Methodological Solution

• Reproduce• Write a failing test• Fix it• Keep the test

It should work!

• Works for logic• Shouldn’t it work for

concurrency?

Repeatability is the issue

• Produce the same result– Any computer– Any configuration

What’s the Solution?

• Proper tools

Catching Race Conditions

• Example using CThru

Catching deadlocks

• Using Racer

Other Tools

• Static Analysis– http://en.wikipedia.org/wiki/List_of_tools_for_sta

tic_code_analysis• AOP

– http://www.bodden.de/tools/aop-dot-net/• Microsoft CHESS

– http://research.microsoft.com/en-us/projects/chess/

Back to Basics

• Code reviews• Awareness

– Architecture• Safe guards• Tools

Questions?

Twitter: @gil_zilberfeldhttp://www.gilzilberfeld.comgilz@typemock.com