SlideShare a Scribd company logo
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

Geolocalización
GeolocalizaciónGeolocalización
Geolocalización
Jimmy Atocza Ledesma
 
Device
DeviceDevice
Geolocalización v2
Geolocalización v2Geolocalización v2
Geolocalización v2
Jimmy Atocza Ledesma
 
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 Plan
Post Planner
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
Kirsty 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 experience
Lino 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-remediation
Jürgen Etzlstorfer
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
Greg Whalin
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
Justin Cataldo
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
fpatton
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
Revanth Mca
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
rajkamal560066
 
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 talk
Aarti Parikh
 
Tyler Wright - Undo History with Flight
Tyler Wright - Undo History with FlightTyler Wright - Undo History with Flight
Tyler Wright - Undo History with Flight
360|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 web
pjcozzi
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.js
jubilem
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert 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
 
PhD Dissertation Defense (April 2015)
PhD Dissertation Defense (April 2015)PhD Dissertation Defense (April 2015)
PhD Dissertation Defense (April 2015)
Shauvik Roy Choudhary, Ph.D.
 
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 components
Jeremy Grancher
 
Shape12 6
Shape12 6Shape12 6
Shape12 6
pslulli
 

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

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 

Recently uploaded (20)

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 

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