the berkeley view: a new framework & a new...

1
C. Park K. Sen How to debug your parallel / concurrent program using Concurrent Breakpoints Concurrent Breakpoints Future Work Uses of Concurrent Breakpoints Cbreakpoints API Concurrent Breakpoints Debugging Software Sequential Programs Add “printf”s near predicted source of bug Add breakpoints and run through a debugger - Breakpoints defined as (L, ) - Suspend program when PC==L and holds - Inspect stack, local variables, etc. Parallel Programs Multiple threads in play Sequential breakpoints are not adequate Heisenbugs due to non-determinism Want deterministic reproduction of bugs Chang - Seo Park and Koushik Sen Example Evaluation Berkeley Parlab Concurrent Breakpoints for 15 programs Reproduced 32 different concurrency bugs Low overhead (<40%), high reproducibility (~99%) Longer wait time for higher trigger rate Refine local predicates for lower overhead Bound number of breakpoint triggers Utilize more contextual information Case study for cyclic debugging Used Concurrent Breakpoints and cyclic debugging methodology to reproduce missed notification Heisenbug in log4j Definition Concurrent Breakpoints defined as a triple (L 1 , L 2 , ) Suspend program when PC Thread1 ==L 1 , PC Thread2 ==L 2 , and holds Unlikely (hard to determine) that two threads are at specific locations simultaneously can be partitioned as local predicates 1 , 2 and global predicate 12 When a thread at L i satisfies local predicate i , wait for another thread to satisfy remaining conditions Resume by starting with Thread1 or Thread2 Specific order can lead to (or prevent) bugs More case studies of using Concurrent Breakpoints for cyclic debugging of Heisenbugs Using Concurrent Breakpoints to specify constrained thread schedules Initially, SynchronizedList L1=[1, 2] and L2=[2,3] Thread1 L1.equals(L2) Thread2 L2.clear() CBreakpoints ConflictBP DeadlockBP Obj: Object DataRaceBP write: bool pLocal: true pGlobal:holds 1 (lock 2 ) && holds 2 (lock 1 ) Express common concurrency bugs such as races, deadlocks, atomicity violations, etc. Concise and programmatic bug report Cheap way to explore different schedules and reproduce bugs Gather information from various executions Enables cyclic debugging pLocal():bool pGlobal(Cbreakpoints b):bool breakHere(isFirst:bool, timeoutms:int):bool pLocal: true pGlobal:obj 1 == obj 2 lock: Object pGlobal:write 1 ||write 2 lock(c) breakHere(true,100) Wait for Thread1 c.clear() unlock(c) e1 = ListIterator() e2 = L2.ListIterator() o1 = e1.next() breakHere(false,100) o2 = e2.next(); Concurrent Modification Exception

Upload: others

Post on 09-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Berkeley View: A New Framework & a New …parlab.eecs.berkeley.edu/sites/all/parlab/files/...Resume by starting with Thread1 or Thread2 Specific order can lead to (or prevent)

C. Park K. Sen

How to debug your parallel / concurrent program using Concurrent Breakpoints

Concurrent Breakpoints

Future Work

Uses of Concurrent Breakpoints

Cbreakpoints API

Concurrent Breakpoints

Debugging Software

Sequential Programs Add “printf”s near predicted source of bug Add breakpoints and run through a debugger

- Breakpoints defined as (L, ) - Suspend program when PC==L and holds - Inspect stack, local variables, etc.

Parallel Programs Multiple threads in play

Sequential breakpoints are not adequate

Heisenbugs due to non-determinism Want deterministic reproduction of bugs

Chang-Seo Park and Koushik Sen

Example

Evaluation

Berkeley Parlab

Concurrent Breakpoints for 15 programs Reproduced 32 different concurrency bugs Low overhead (<40%), high reproducibility (~99%)

Longer wait time for higher trigger rate

Refine local predicates for lower overhead Bound number of breakpoint triggers Utilize more contextual information

Case study for cyclic debugging Used Concurrent Breakpoints and cyclic debugging

methodology to reproduce missed notification Heisenbug in log4j

Definition Concurrent Breakpoints defined as a triple (L1, L2, ) Suspend program when PCThread1==L1, PCThread2==L2,

and holds

Unlikely (hard to determine) that two threads are at

specific locations simultaneously can be partitioned as local predicates 1, 2 and global

predicate 12

When a thread at Li satisfies local predicate i, wait for another thread to satisfy remaining conditions

Resume by starting with Thread1 or Thread2 Specific order can lead to (or prevent) bugs

More case studies of using Concurrent Breakpoints for cyclic debugging of Heisenbugs

Using Concurrent Breakpoints to specify constrained thread schedules

Initially, SynchronizedList L1=[1, 2] and L2=[2,3]

Thread1

L1.equals(L2)

Thread2

L2.clear()

CBreakpoints

ConflictBP DeadlockBP

Obj: Object

DataRaceBP

write: bool

pLocal: true

pGlobal:holds1(lock2)

&& holds2(lock1)

Express common concurrency bugs such as races, deadlocks, atomicity violations, etc. Concise and programmatic bug report

Cheap way to explore different schedules and

reproduce bugs Gather information from various executions Enables cyclic debugging

pLocal():bool

pGlobal(Cbreakpoints b):bool

breakHere(isFirst:bool,

timeoutms:int):bool

pLocal: true

pGlobal:obj1 == obj2

lock: Object

pGlobal:write1||write2

lock(c)

breakHere(true,100)

Wait for Thread1

c.clear()

unlock(c)

e1 = ListIterator()

e2 = L2.ListIterator()

o1 = e1.next()

breakHere(false,100)

o2 = e2.next();

Concurrent

Modification

Exception