SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Replay your productions bugs
JavaZone 2013
Mads Enevoldsen, Developer, Jayway
Overview
• Problem Definition
• Tracing
• Reproducablilty
• Threads
• Example Architecture
Part I
Problem Definition
Spot of bother
• Why are errors communicated in stack traces?
• Why are production bugs hunted down by inspecting log files?
• Why can’t we communicate in running code?
Unit test
• Proves how code works
• Deterministic
• Environment agnostic
Execution path
1 public class Example {
2
3 public void foo() {
4 bar();
5 // exception occurs
6 }
7
8 private void bar() {
9 //...
10 }
11 }
Computable?
• Reasoning about code
• Source code vs. running code
Part II
Tracing
Deja Vu
• Open source
• Define trace points in your code
• Serialize traces to unit tests
Example
1 public class Example {
2
3 @Traced
4 public void foo() {
5 bar();
6 //...
7 }
8
9 private void bar() {
10 //...
11 }
12 }
@Traced
• Method annotation
• Define ”lumps” of code to be traced
• Store arguments and method ”pointer”
• No state in objects
Setup
• Install callback
• Trace-mode for tracing @Traced
• Replay-mode for re-running generated traces
Replay
1 public class ExampleTest{
2
3 @Test
4 public void exampletest() throws Throwable {
5 TraceBuilder builder = TraceBuilder.build().
6 setMethod(Example.class);
7
8 builder.run();
9 }
10 }
Part III
Reproducability
@Impure
• Randomized/Non-deterministic
• Environment dependent
• Threading
Rules of the game
• Immutable
• Must be serializable++
Lucky number bug
1 public class AlmostWorking {
2
3 @Traced
4 public void getLucky() {
5 Long value = timeStamp();
6 Long luckyNumber = 2304432 / ( value % 1001 );
7 System.out.println( "My lucky number is: "+luckyNumber);
8 }
9
10 @Impure
11 private Long timeStamp() {
12 return System.nanoTime();
13 }
14 }
Overhead
• Execution overhead in intercepting calls
• Memory overhead in storing ”impure” values
• Immutable overhead
Part IV
Threads
Threads
• Non-deterministic!
• For pure parts it doesn’t matter
@AttachThread
• Includes a thread in a trace
• Trace is not done until trace method is executed...
• ...and all attached threads are done executing
• Impure parts are replayed in same order
Example
1 public class WithThreads {
2
3 private ExecutorService executorService;
4
5 public void initialize() {
6 executorService = Executors.newCachedThreadPool();
7 }
8
9 @Traced
10 public void begin( Integer threads) {
11 initialize();
12 for ( int i=0; i<threads; i++ ) {
13 runInThreadPool(new Runner());
14 }
15 }
16
17 @AttachThread
18 private void runInThreadPool( Runnable runnable ) {
19 executorService.submit(runnable);
20 }
21 }
Part V
Example Architecture
Usecases
• Trace on each ’usecase’
• Usecase becomes a programming concept
Thank you
• https://github.com/madsenevoldsen/dejavu
• http://www.jayway.com/2013/01/09/deja-vu/

Mais conteúdo relacionado

Mais procurados

Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)
ceng
 
Dynamic PHP web-application analysis
Dynamic PHP web-application analysisDynamic PHP web-application analysis
Dynamic PHP web-application analysis
ax330d
 
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Jian-Hong Pan
 

Mais procurados (18)

.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in Kotlin
 
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
 
Test Driven Development iOS에 적용해보기
Test Driven Development  iOS에 적용해보기Test Driven Development  iOS에 적용해보기
Test Driven Development iOS에 적용해보기
 
Remote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profitRemote file path traversal attacks for fun and profit
Remote file path traversal attacks for fun and profit
 
Code Crime Scene pawel klimczyk
Code Crime Scene   pawel klimczykCode Crime Scene   pawel klimczyk
Code Crime Scene pawel klimczyk
 
CNIT 127 Ch 4: Introduction to format string bugs
CNIT 127 Ch 4: Introduction to format string bugsCNIT 127 Ch 4: Introduction to format string bugs
CNIT 127 Ch 4: Introduction to format string bugs
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
Storm
StormStorm
Storm
 
Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)
 
CNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingCNIT 126: 13: Data Encoding
CNIT 126: 13: Data Encoding
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
 
Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An ExampleExploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
 
Dynamic PHP web-application analysis
Dynamic PHP web-application analysisDynamic PHP web-application analysis
Dynamic PHP web-application analysis
 
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
 
Code Crime Scene
Code Crime SceneCode Crime Scene
Code Crime Scene
 

Semelhante a Deja vu JavaZone 2013

Threads in java, Multitasking and Multithreading
Threads in java, Multitasking and MultithreadingThreads in java, Multitasking and Multithreading
Threads in java, Multitasking and Multithreading
ssusere538f7
 
13multithreaded Programming
13multithreaded Programming13multithreaded Programming
13multithreaded Programming
Adil Jafri
 
OOPS object oriented programming UNIT-4.pptx
OOPS object oriented programming UNIT-4.pptxOOPS object oriented programming UNIT-4.pptx
OOPS object oriented programming UNIT-4.pptx
Arulmozhivarman8
 

Semelhante a Deja vu JavaZone 2013 (20)

Qt multi threads
Qt multi threadsQt multi threads
Qt multi threads
 
East Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
East Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...East Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
East Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
 
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
 
Threads in java, Multitasking and Multithreading
Threads in java, Multitasking and MultithreadingThreads in java, Multitasking and Multithreading
Threads in java, Multitasking and Multithreading
 
Who go Types in my Systems Programing!
Who go Types in my Systems Programing!Who go Types in my Systems Programing!
Who go Types in my Systems Programing!
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
Operating System lab
Operating System labOperating System lab
Operating System lab
 
Non blocking programming and waiting
Non blocking programming and waitingNon blocking programming and waiting
Non blocking programming and waiting
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
 
advanced java ppt
advanced java pptadvanced java ppt
advanced java ppt
 
13multithreaded Programming
13multithreaded Programming13multithreaded Programming
13multithreaded Programming
 
OOPS object oriented programming UNIT-4.pptx
OOPS object oriented programming UNIT-4.pptxOOPS object oriented programming UNIT-4.pptx
OOPS object oriented programming UNIT-4.pptx
 
Java threads
Java threadsJava threads
Java threads
 
Advanced debugging
Advanced debuggingAdvanced debugging
Advanced debugging
 
Threads
ThreadsThreads
Threads
 
Multi Threading
Multi ThreadingMulti Threading
Multi Threading
 
DevoxxUK: Is your profiler speaking the same language as you?
DevoxxUK: Is your profiler speaking the same language as you?DevoxxUK: Is your profiler speaking the same language as you?
DevoxxUK: Is your profiler speaking the same language as you?
 
Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?
 
Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 

Último

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Deja vu JavaZone 2013