19
Veranstal ter: Speziell zu Software- Testing 14.-15. Februar 2011, München Rise of the Heisenbug Gil Zilberfeld

Rise of the Heisenbug

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Rise of the Heisenbug

Veranstalter:

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

Rise of the HeisenbugGil Zilberfeld

Page 2: Rise of the Heisenbug

Who Am I?

• Software developer for 15 years

• Product Manager at Typemock

• @gil_zilberfeld

• www.gilzilberfeld.com

Page 3: Rise of the Heisenbug

What’s the plan?

• A humble beginning• Heisenbugs• Tools and solutions

Page 4: Rise of the Heisenbug

My First TDD Project

Page 5: Rise of the Heisenbug

Progress has beaten us

• The Multicore• Mainstream

Languages don’t help• Tools are complex

Page 6: Rise of the Heisenbug

We can do so much more

Page 7: Rise of the Heisenbug

Concurrency problems

• State problems• Race conditions• Deadlocks

Page 8: Rise of the Heisenbug

Heisenberg’s Uncertainty Principle

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

Page 9: Rise of the Heisenbug

Heisenbug

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

Page 10: Rise of the Heisenbug

Heisenbugs

• Identification is hard• Reproduction is

hard• Fixing is easy• Checking the fix is

hard

Page 11: Rise of the Heisenbug

A Methodological Solution

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

Page 12: Rise of the Heisenbug

It should work!

• Works for logic• Shouldn’t it work for

concurrency?

Page 13: Rise of the Heisenbug

Repeatability is the issue

• Produce the same result– Any computer– Any configuration

Page 14: Rise of the Heisenbug

What’s the Solution?

• Proper tools

Page 15: Rise of the Heisenbug

Catching Race Conditions

• Example using CThru

Page 16: Rise of the Heisenbug

Catching deadlocks

• Using Racer

Page 17: Rise of the Heisenbug

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/

Page 18: Rise of the Heisenbug

Back to Basics

• Code reviews• Awareness

– Architecture• Safe guards• Tools

Page 19: Rise of the Heisenbug

Questions?

Twitter: @gil_zilberfeldhttp://[email protected]