SlideShare a Scribd company logo
1 of 25
Download to read offline
EventRacer: Finding Concurrency Errors 
in Event-Driven Applications 
Pavol Bielik
Android Errors Caused by Concurrency 
Display article twice Display wrong directory Display wrong order 1
Web Page Errors Caused by Concurrency 
Incomplete form 
jQuery version used non-deterministically 
submitted Non-operational menu 
2
Event-Driven Applications 
designed to hide latency, various asynchronous APIs 
network, disk, database, timers, UI events 
highly asynchronous and complex control flow 
scheduling non-determinism 
asynchrony is not intuitive 
3
Trouble with Asynchrony 
Background task, progress dialog, orientation change - is there any 100% working solution? 
JavaScript function sometimes called, sometimes not 
Avoiding race conditions in Google Analytics asynchronous tracking 
Ajax Call Sometimes Works, Sometime works and refreshes, Sometimes refreshes and fails …? 
Is AsyncTask really conceptually flawed or am I just missing something? 
4
“Hello World” of web page concurrency 
<html><body> 
<script> 
var v=undefined; 
</script> 
<img src="img1.png" onload="v='Hi!';"> 
<img src="img2.png" onload="alert(v);"> 
</body></html> 
Browser Server 
fetch img1.png 
fetch img2.png 
load img1.png 
load img2.png 
v:undefined 
v:’Hi!’ 
Hi! 
5
Bad interleaving 
<html><body> 
<script> 
var v=undefined; 
</script> 
<img src="img1.png" onload="v='Hi!';"> 
<img src="img2.png" onload="alert(v);"> 
</body></html> 
Browser Server 
fetch img1.png 
fetch img2.png 
load img2.png 
v:undefined 
undefined 
5
Understanding the problem 
<html><body> 
<script> 
var v=undefined; 
</script> 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
</body></html> 
Event Actions 
6
Understanding the problem 
<html><body> 
<script> 
var v=undefined; 
</script> 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
</body></html> 
Event Actions 
Happens-before 
6
Understanding the problem 
<html><body> 
<script> 
var v=undefined; 
</script> 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
</body></html> 
Race 
write v 
read v 
Event Actions 
Happens-before 
6
Online Analysis 
http://www.eventracer.org 
7
EventRacer end-to-end System 
Instrumented 
System 
Execution 
Trace 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
7
EventRacer end-to-end System 
DOM nodes and attributes 
<img id="img1" src="img1.png" 
onload="v='Hi!';"> 
<script> 
document.getElementById("img1") 
.addEventListener("click", f); 
</script> 
↦ write(#img1) 
↦ write(#img1.onload) 
↦ read(#img1) 
↦ write(#img1.click) 
Instrumented 
System 
Execution 
Trace 
What are the memory locations on 
which asynchronous events can race? 
JS variables, functions, arrays 
<script> 
v='Hi!'; 
function f() {} 
messages[2] = 42; 
</script> 
↦ write(v) 
↦ write(f) 
↦ write(messages[2]) 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
8
EventRacer end-to-end System 
Instrumented 
System 
Web 
- parsing an HTML element 
- executing a script 
- handling user input 
- ... 
<script> 
var v=undefined; 
</script> 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
Execution 
Trace 
What are the atomic events used in 
event-driven applications? 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
9
EventRacer end-to-end System 
Happens-before 
<script> 
var v=undefined; 
</script> 
Happens-before 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
Instrumented 
System 
Execution 
Trace 
What is the event happens-before? 
Web 
setInterval, SetTimeout, AJAX, … 
Android 
postDelayed, postAtFront, postIdle, ... 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
10
EventRacer end-to-end System 
<script> 
var v=undefined; 
</script> 
Race 
write v 
<img src=”img1.png” onload=”v=’Hi!’;”> 
<img src=”img2.png” onload=”alert(v);”> 
read v 
Instrumented 
System 
Execution 
Trace 
How to make scalable race detection in 
event-based setting? 
(Naive algorithms have asymptotic complexity O(N3) and 
require O(N2) space) 
State of the art EventRacer 
runtime TIMEOUT 2.4sec 
memory 25181MB 171MB 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
11
EventRacer end-to-end System 
Is the system effective at finding 
harmful races while reporting few 
benign races? 
We filter common classes of benign 
races: 
commutative operations, recycled objects, lazy 
initialization, local reads, ... 
Web Android 
# races found 646 1328 
# races reported 17.3 13 
reduction 37x 100x 
Instrumented 
System 
Execution 
Trace 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page 
13
Manual evaluation 
Fortune 100 Web Pages 
25% 
17.3% 
synchronization races 
various idioms: 
✓ if (ready) … 
✓ try { … } catch { retry } 
✓ array of callbacks 
✓ etc. 
harmless races 
✓ commutative 
operations 
✓ benign races 
✓ framework related 
Web (314 reports) 
Harmful bugs 
✓ unhandled exceptions 
✓ UI glitches 
✓ broken analytics 
✓ page needs refresh to 
work normally 
Android (104 reports) 
8 Play Store Applications 
14 
24.6% 
58.4% 
17% 57.7%
Simple GPS Tracker 
protected void onCreate() { 
locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, mListener); 
mDbHelper = new SQLiteOpenHelper(this, DB_NAME, DB_VERSION); 
} 
LocationListener mListener = new LocationListener() { 
public void onLocationChanged(Location location) { 
//show location on map 
mDbHelper.getWritableDatabase().insert(loc); 
} }; 
protected void onStop() { 
locationManager.removeUpdates(mListener); 
mDbHelper.close(); 
} 
15
Simple GPS Tracker 
protected void onCreate() { 
locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, mListener); 
mDbHelper = new SQLiteOpenHelper(this, DB_NAME, DB_VERSION); 
} 
LocationListener mListener = new LocationListener() { 
public void onLocationChanged(Location location) { 
//show location on map 
mDbHelper.getWritableDatabase().insert(loc); 
} }; 
protected void onStop() { 
locationManager.removeUpdates(mListener); 
mDbHelper.close(); 
} 
15 
public void removeUpdates (LocationListener listener) 
Added in API level 1 
Removes all location updates for the specified LocationListener. 
Following this call, updates will no longer occur for this listener.
http://www.eventracer.org/android 
16
Analysis Results 
onLocationChanged and onStop are reported as not ordered 
event 1 source 
async IPC, interface(android.location.ILocationListener), 
code(onLocationChanged)) 
event 2 source 
async IPC, interface(android.app.IApplicationThread), code 
(SCHEDULE_STOP_ACTIVITY)) 
→calling context 
Landroid/database/sqlite/SQLiteDatabase;.insert(...) 
→calling context 
Landroid/database/sqlite/SQLiteClosable;.close(...) 
→ UPDATE-UPDATE - 63568 Landroid/database/sqlite/SQLiteConnectionPool;.mAvailablePrimaryConnection 
→ READ-UPDATE - 63568 Landroid/database/sqlite/SQLiteConnectionPool;.mIsOpen 
→ READ-UPDATE - 63576 Landroid/database/sqlite/SQLiteConnection;.mConnectionPtr 
→ READ-UPDATE - 63576 Landroid/database/sqlite/SQLiteConnection;.mPreparedStatementPool 
16
Is the Alternative Interleaving Feasible? 
D/GPS: onCreate 
D/GPS: insert: Location[gps 47.284646,8.632389 acc=10 et=0 vel=2.0 mock] 
D/GPS: insert: Location[gps 47.284656,8.632598 acc=10 et=0 vel=2.0 mock] 
D/GPS: insert: Location[gps 47.284712,8.632722 acc=10 et=0 vel=2.0 mock] 
D/GPS: insert: Location[gps 47.284832,8.632837 acc=10 et=0 vel=2.0 mock] 
D/GPS: onStop 
D/GPS: insert: Location[gps 47.285022,8.633205 acc=10 et=0 vel=2.0 mock] 
E/AndroidRuntime: FATAL EXCEPTION: main 
E/AndroidRuntime: Process: com.example.gps, PID: 2249 
E/AndroidRuntime: java.lang.IllegalStateException: attempt to re-open an 
already-closed object: SQLiteDatabase: /data/data/com.example.gps/test.db 
16
Current Directions 
Google Chromium port 
V8 javascript engine instrumentation 
Testing tools based on EventRacer 
Integration with Selenium 
PhantomJS 
Application for Parallelization 
Other Application Domains (beyond Web Pages, Android) 
Node.js 
17
www.eventracer.org 
Martin Vechev, Veselin Raychev, Pavol Bielik 
Anders Møller, Casper Jensen 
Manu Sridharan 
Boris Petrov, Yasen Trifonov 
Julian Dolby 
Instrumented 
System 
Execution 
Trace 
Happens-before 
Graph 
Race 
Detector 
? 
? 
? 
Race 
Explorer 
Race Filtering 
and Grouping 
Android App, 
Web Page

More Related Content

Viewers also liked

Fundamentos de la ciencia e ingeniería de materiales 3ra edición - william ...
Fundamentos de la ciencia e ingeniería de materiales   3ra edición - william ...Fundamentos de la ciencia e ingeniería de materiales   3ra edición - william ...
Fundamentos de la ciencia e ingeniería de materiales 3ra edición - william ...Wiłłiam Garcia
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanPost Planner
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
 

Viewers also liked (7)

Geolocalización
GeolocalizaciónGeolocalización
Geolocalización
 
Device
DeviceDevice
Device
 
Geolocalización v2
Geolocalización v2Geolocalización v2
Geolocalización v2
 
Fundamentos de la ciencia e ingeniería de materiales 3ra edición - william ...
Fundamentos de la ciencia e ingeniería de materiales   3ra edición - william ...Fundamentos de la ciencia e ingeniería de materiales   3ra edición - william ...
Fundamentos de la ciencia e ingeniería de materiales 3ra edición - william ...
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 

Similar to Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14

Oracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experienceOracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experienceLino Schildenfeld
 
A framework for self-healing applications – the path to enable auto-remediation
A framework for self-healing applications – the path to enable auto-remediationA framework for self-healing applications – the path to enable auto-remediation
A framework for self-healing applications – the path to enable auto-remediationJürgen Etzlstorfer
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup PerformanceGreg Whalin
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOSfpatton
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalorerajkamal560066
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Massimo Oliviero
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
 
Tyler Wright - Undo History with Flight
Tyler Wright - Undo History with FlightTyler Wright - Undo History with Flight
Tyler Wright - Undo History with Flight360|Conferences
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webpjcozzi
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.jsjubilem
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonRobert Nyman
 
Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"Provectus
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Jung Kim
 
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap..."Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...Fwdays
 
ユニバーサル Windows アプリ開発
ユニバーサル Windows アプリ開発ユニバーサル Windows アプリ開発
ユニバーサル Windows アプリ開発Akira Onishi
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom componentsJeremy Grancher
 
Shape12 6
Shape12 6Shape12 6
Shape12 6pslulli
 

Similar to Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14 (20)

Oracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experienceOracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experience
 
A framework for self-healing applications – the path to enable auto-remediation
A framework for self-healing applications – the path to enable auto-remediationA framework for self-healing applications – the path to enable auto-remediation
A framework for self-healing applications – the path to enable auto-remediation
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talk
 
Tyler Wright - Undo History with Flight
Tyler Wright - Undo History with FlightTyler Wright - Undo History with Flight
Tyler Wright - Undo History with Flight
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.js
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 
Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"Vlad Nedomovniy "Navigation with less pain"
Vlad Nedomovniy "Navigation with less pain"
 
PhD Dissertation Defense (April 2015)
PhD Dissertation Defense (April 2015)PhD Dissertation Defense (April 2015)
PhD Dissertation Defense (April 2015)
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
 
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap..."Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
 
ユニバーサル Windows アプリ開発
ユニバーサル Windows アプリ開発ユニバーサル Windows アプリ開発
ユニバーサル Windows アプリ開発
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
Shape12 6
Shape12 6Shape12 6
Shape12 6
 

Recently uploaded

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14

  • 1. EventRacer: Finding Concurrency Errors in Event-Driven Applications Pavol Bielik
  • 2. Android Errors Caused by Concurrency Display article twice Display wrong directory Display wrong order 1
  • 3. Web Page Errors Caused by Concurrency Incomplete form jQuery version used non-deterministically submitted Non-operational menu 2
  • 4. Event-Driven Applications designed to hide latency, various asynchronous APIs network, disk, database, timers, UI events highly asynchronous and complex control flow scheduling non-determinism asynchrony is not intuitive 3
  • 5. Trouble with Asynchrony Background task, progress dialog, orientation change - is there any 100% working solution? JavaScript function sometimes called, sometimes not Avoiding race conditions in Google Analytics asynchronous tracking Ajax Call Sometimes Works, Sometime works and refreshes, Sometimes refreshes and fails …? Is AsyncTask really conceptually flawed or am I just missing something? 4
  • 6. “Hello World” of web page concurrency <html><body> <script> var v=undefined; </script> <img src="img1.png" onload="v='Hi!';"> <img src="img2.png" onload="alert(v);"> </body></html> Browser Server fetch img1.png fetch img2.png load img1.png load img2.png v:undefined v:’Hi!’ Hi! 5
  • 7. Bad interleaving <html><body> <script> var v=undefined; </script> <img src="img1.png" onload="v='Hi!';"> <img src="img2.png" onload="alert(v);"> </body></html> Browser Server fetch img1.png fetch img2.png load img2.png v:undefined undefined 5
  • 8. Understanding the problem <html><body> <script> var v=undefined; </script> <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> </body></html> Event Actions 6
  • 9. Understanding the problem <html><body> <script> var v=undefined; </script> <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> </body></html> Event Actions Happens-before 6
  • 10. Understanding the problem <html><body> <script> var v=undefined; </script> <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> </body></html> Race write v read v Event Actions Happens-before 6
  • 12. EventRacer end-to-end System Instrumented System Execution Trace Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 7
  • 13. EventRacer end-to-end System DOM nodes and attributes <img id="img1" src="img1.png" onload="v='Hi!';"> <script> document.getElementById("img1") .addEventListener("click", f); </script> ↦ write(#img1) ↦ write(#img1.onload) ↦ read(#img1) ↦ write(#img1.click) Instrumented System Execution Trace What are the memory locations on which asynchronous events can race? JS variables, functions, arrays <script> v='Hi!'; function f() {} messages[2] = 42; </script> ↦ write(v) ↦ write(f) ↦ write(messages[2]) Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 8
  • 14. EventRacer end-to-end System Instrumented System Web - parsing an HTML element - executing a script - handling user input - ... <script> var v=undefined; </script> <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> Execution Trace What are the atomic events used in event-driven applications? Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 9
  • 15. EventRacer end-to-end System Happens-before <script> var v=undefined; </script> Happens-before <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> Instrumented System Execution Trace What is the event happens-before? Web setInterval, SetTimeout, AJAX, … Android postDelayed, postAtFront, postIdle, ... Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 10
  • 16. EventRacer end-to-end System <script> var v=undefined; </script> Race write v <img src=”img1.png” onload=”v=’Hi!’;”> <img src=”img2.png” onload=”alert(v);”> read v Instrumented System Execution Trace How to make scalable race detection in event-based setting? (Naive algorithms have asymptotic complexity O(N3) and require O(N2) space) State of the art EventRacer runtime TIMEOUT 2.4sec memory 25181MB 171MB Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 11
  • 17. EventRacer end-to-end System Is the system effective at finding harmful races while reporting few benign races? We filter common classes of benign races: commutative operations, recycled objects, lazy initialization, local reads, ... Web Android # races found 646 1328 # races reported 17.3 13 reduction 37x 100x Instrumented System Execution Trace Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page 13
  • 18. Manual evaluation Fortune 100 Web Pages 25% 17.3% synchronization races various idioms: ✓ if (ready) … ✓ try { … } catch { retry } ✓ array of callbacks ✓ etc. harmless races ✓ commutative operations ✓ benign races ✓ framework related Web (314 reports) Harmful bugs ✓ unhandled exceptions ✓ UI glitches ✓ broken analytics ✓ page needs refresh to work normally Android (104 reports) 8 Play Store Applications 14 24.6% 58.4% 17% 57.7%
  • 19. Simple GPS Tracker protected void onCreate() { locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, mListener); mDbHelper = new SQLiteOpenHelper(this, DB_NAME, DB_VERSION); } LocationListener mListener = new LocationListener() { public void onLocationChanged(Location location) { //show location on map mDbHelper.getWritableDatabase().insert(loc); } }; protected void onStop() { locationManager.removeUpdates(mListener); mDbHelper.close(); } 15
  • 20. Simple GPS Tracker protected void onCreate() { locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, mListener); mDbHelper = new SQLiteOpenHelper(this, DB_NAME, DB_VERSION); } LocationListener mListener = new LocationListener() { public void onLocationChanged(Location location) { //show location on map mDbHelper.getWritableDatabase().insert(loc); } }; protected void onStop() { locationManager.removeUpdates(mListener); mDbHelper.close(); } 15 public void removeUpdates (LocationListener listener) Added in API level 1 Removes all location updates for the specified LocationListener. Following this call, updates will no longer occur for this listener.
  • 22. Analysis Results onLocationChanged and onStop are reported as not ordered event 1 source async IPC, interface(android.location.ILocationListener), code(onLocationChanged)) event 2 source async IPC, interface(android.app.IApplicationThread), code (SCHEDULE_STOP_ACTIVITY)) →calling context Landroid/database/sqlite/SQLiteDatabase;.insert(...) →calling context Landroid/database/sqlite/SQLiteClosable;.close(...) → UPDATE-UPDATE - 63568 Landroid/database/sqlite/SQLiteConnectionPool;.mAvailablePrimaryConnection → READ-UPDATE - 63568 Landroid/database/sqlite/SQLiteConnectionPool;.mIsOpen → READ-UPDATE - 63576 Landroid/database/sqlite/SQLiteConnection;.mConnectionPtr → READ-UPDATE - 63576 Landroid/database/sqlite/SQLiteConnection;.mPreparedStatementPool 16
  • 23. Is the Alternative Interleaving Feasible? D/GPS: onCreate D/GPS: insert: Location[gps 47.284646,8.632389 acc=10 et=0 vel=2.0 mock] D/GPS: insert: Location[gps 47.284656,8.632598 acc=10 et=0 vel=2.0 mock] D/GPS: insert: Location[gps 47.284712,8.632722 acc=10 et=0 vel=2.0 mock] D/GPS: insert: Location[gps 47.284832,8.632837 acc=10 et=0 vel=2.0 mock] D/GPS: onStop D/GPS: insert: Location[gps 47.285022,8.633205 acc=10 et=0 vel=2.0 mock] E/AndroidRuntime: FATAL EXCEPTION: main E/AndroidRuntime: Process: com.example.gps, PID: 2249 E/AndroidRuntime: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.gps/test.db 16
  • 24. Current Directions Google Chromium port V8 javascript engine instrumentation Testing tools based on EventRacer Integration with Selenium PhantomJS Application for Parallelization Other Application Domains (beyond Web Pages, Android) Node.js 17
  • 25. www.eventracer.org Martin Vechev, Veselin Raychev, Pavol Bielik Anders Møller, Casper Jensen Manu Sridharan Boris Petrov, Yasen Trifonov Julian Dolby Instrumented System Execution Trace Happens-before Graph Race Detector ? ? ? Race Explorer Race Filtering and Grouping Android App, Web Page