SlideShare a Scribd company logo
LeakPair: Proactive Repairing of
Leaks in Single Page Web Applications
Arooba Shahoor
Kyungpook National University, Korea
Askar Yeltayuly Khamit
UNIST, Korea
Jooyong Yi
UNIST, Korea
Dongsun Kim
Kyungpook National University, Korea
The 38th IEEE/ACM International Conference on Automated Software Engineering (ASE 2023)
14 September 2023
with ACM Distinguished Paper Award
2
4
MOTIVATION
Why Are Memory
Leaks Critical in the
SPA Architecture?
5
Client
Page switching with reload
User Interface
Page 1
Page 2
Page 3
HTTP Request for
initial page load
HTTP Request for
page transition
Server
<template>
Presentation Layer
Database &
Business Logic
Multi Page Application Architecture
6
New page for each request
Inside the Heap
Object 3
Object 2
Object 4
Object 1
Allocated objects from
previous page all wiped off
On user interactions
Client
No reload required
SPA Framework
(Angular/React/Vue..)
Single .html file
<template 1>
<template 2>
<template 3>
View switching without
reload
User Interface
View 1
View 2
View 3
HTTP Request
for initial page
load
AJAX Request for
page transition
Server
Single Page Application Architecture
7
Database &
Business
Logic
Object 3
Object 4
Object 2
Object 1
Object 6
Object 5 This page is never refreshed…
On user interactions
Inside the Heap
Unintentional references
will keep piling up!
Object 7
Object 8
Object 9
JavaScript Devs Can’t Rely on Garbage
Collectors
Garbage Collection in JS (Mark and Sweep)
Reachability from Root
Object 4
Object 5
Object 2
Object 8
Object 6
Object 7
Object 3
Object 1
View 1 (Inside Heap)
window
(GC ROOT 1)
String
(GC ROOT 2)
Garbage Collection in JS (Mark and Sweep)
Reachability from Root
Object 4
Object 5
Object 2
Object 8
UNUSED
Object 7
UNUSED
Object 1
View 2 (Inside Heap)
UNUSED
UNUSED
window
(GC ROOT 1)
String
(GC ROOT 2)
Garbage Collection in JS (Mark and Sweep)
Reachability from Root
UNUSED
MARK
Object 5
MARK
Object 2
MARK
UNUSED
MARK
UNUSED
MARK
Object 7
SWEEP
UNUSED
MARK
Object 1
MARK
View 2 (Inside Heap)
Unused objects marked as alive
and will not be GC’ed, due to
reachability from GC root
window
(GC ROOT 1)
String
(GC ROOT 2)
Garbage Collection in JS (Mark and Sweep)
Reachability from Root
UNUSED
MARK
Object 5
MARK
Object 2
MARK
UNUSED
MARK
UNUSED
MARK
UNUSED
MARK
Object 1
MARK
View 2 (Inside Heap)
window
(GC ROOT 1)
String
(GC ROOT 2)
Garbage Collection in JS (Mark and Sweep)
Reachability from Root
UNUSED
Object 5
Object 2
UNUSED
UNUSED
UNUSED
Object 1
View 3 (Inside Heap)
window
(GC ROOT 1)
String
(GC ROOT 2)
New
object 1
New
object 2
Lingering unwanted objects will
keep gobbling up available space
for newer objects
New
object 3
14
Case in Point
Memory Leak in MS Rooster [2]
Reachable from root
The fix
Leak Detection in JS
Automation Efforts (2015-2022)
2015. MemInsight [3] Reports stale objects, by
computing object lifetimes.
2016. LeakSpot [4] Reports all allocation and
reference sites of leaked objects.
2018. Bleak [5] Identifies and reports leaked
objects by running the website in a headless
browser.
2022. Memlab [7] Reports retainer traces of leaked
objects by running the website in a headless
browser.
15
MemInsight
LeakSpot
Bleak
Memlab
The Problem With Automated Detection Tools
16
Based on staleness criteria + report leak-related
data rather than actual leak locations
Bleak Takes at least 10 mins to execute
Memlab Reported retainer traces contain metadata and internal
objects, making root cause detection arduous
Require manually-written scenario file
State of the Art
● Manual diagnosis via heap snapshots
● Three snapshot technique
● First introduced by Gmail team in 2012
● Detecting root cause can be laborious and inaccurate
17
A change of
perspective
18
What we need is…
APPROACH
19
Proactive
strategy
● Patches that are simple,
non-intrusive and recurring.
● Enable repairs before fault
localization.
● Avoiding detection step is a
huge advantage.
Based on fix patterns [1].
20
[1] D. Kim, J. Nam, J. Song, and S. Kim, “Automatic Patch Generation Learned from
Human-written Patches,” in Proceedings of the 2013 International Conference on Software
Engineering, in ICSE ’13. Piscataway, NJ, USA: IEEE Press, 2013, pp. 802–811.
Leak Pattern Mining
● Search targets: GitHub and Stack Overflow.
● Reported at least 5 times.
● Acknowledged by at least 2 developers.
● Replicable and testable.
21
Fix Pattern Mining
● Stack Overflow answers accepted in at
least 2 posts.
● GitHub commits merged in at least 2
projects.
● Verified by comparing memory footprints
before and after.
22
4 Leaks and
(Corresponding) Fix
Patterns
23
1. Uncleared Timing Events (setTimeout and setInterval)
{
…
setTimeOut(() => {...})
…
}
{
…
setTimeOut(() => {...})
timeOutID = setTimeOut(() => {...})
...
destructorMethodDeclaration() {
...
clearTimeOut(timeOutID)
}
}
If component unmounts before time, these events will still execute,
retaining references of all enclosing objects.
Fix Pattern
Leak Pattern
Other leak patterns
2. Unreleased subscription
3. Unremoved event listener
4. Uncanceled animation frame request
24
Applying Fix Patterns
SPA project Identify JS file(s) Transform to AST Find leak pattern
matches
Match
found?
Apply fix to
AST
Yes
Convert back
to source
EVALUATION
26
Research Questions
RQ1. Effectiveness How effective is the tool at
minimizing memory leaks?
RQ2. Acceptance How useful are generated patches,
as perceived by developers?
RQ3. Correctness What is the impact of our tool on
test suite execution results?
27
Subjects
Known leaks Leaks already detected and fixed by developers.
Unknown leaks Leaks developers were not aware of.
10 open source SPA projects with already known
memory leaks: Microsoft’s Rooster, Fundamental Library for
Angular, Material UI…
10 projects with unfound leaks at the time of
evaluation: Angular Extentions Elements,
react-multi-carousel, ngx-bootstrap…
28
29
Effectiveness Evaluation (RQ 1)
Compare before and after footprints
Execute Memlab
(10 Iterations)
Note memory
footprints
SPA subject
LEAKPAIR
Execute LeakPair
Run the SPA
Subject
Scenario file
(10 Loops)
Note memory
footprints again
30
Effectiveness Evaluation (RQ 1)
Compare before and after footprints
Execute Memlab
(10 Iterations)
Note memory
footprints
SPA subject
LEAKPAIR
Execute LeakPair
Run the SPA
Subject
Scenario file
(10 Loops)
Note memory
footprints again
Compare before
and after footprints
31
Acceptance Evaluation (RQ 2)
Is heap size or
leak count
reduced? Yes
Is unknown
leak?
Yes
Submit fix as PR Track PR status
32
Correctness Evaluation (RQ 3)
Execute test suite
(If available)
SPA subject
LEAKPAIR
Execute LeakPair
Run the SPA
Subject
Note build/
compile time
Note passing/failing
test cases
Note build/compile
time and test case
results again
Compare before and after test cases results and execution times
RESULTS
33
Effectiveness (RQ 1)
● 8 of 10 subjects with known leaks had
noticeable heap reductions.
● 7 of 10 subjects with unknown leaks had
significant heap reductions (4 -18%).
● All subjects had memory leak reductions.
34
LeakPair patches can successfully
prevent leaks and reduce heap,
without leak detection.
Acceptance (RQ 2)
● Total = 20 pull requests
● Agreed = 12 (60%)
Merged Approved Improved Ignored
9 2 1 8
35
LeakPair patches are acceptable to
developers, with more than half of
patch suggestions being accepted.
Correctness (RQ 3)
● Successful build/compilation
● Count of passing/failing test cases of
10 of 10 unchanged
● Execution times before and after LP
execution shared the same range for
all 10 projects
36
LeakPair patches are non-intrusive;
they neither break functionality, nor
incur execution time delays.
Summary
37

More Related Content

Similar to LeakPair: Proactive Repairing of Leaks in Single Page Web Applications

Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
John Stevenson
 
Practicing at the Cutting Edge: Learning and Unlearning about Java Performance
Practicing at the Cutting Edge: Learning and Unlearning about Java PerformancePracticing at the Cutting Edge: Learning and Unlearning about Java Performance
Practicing at the Cutting Edge: Learning and Unlearning about Java Performance
C4Media
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
Trayan Iliev
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
Changhwan Yi
 
Cross-platform UI Engines Rendering Performance
Cross-platform UI Engines Rendering PerformanceCross-platform UI Engines Rendering Performance
Cross-platform UI Engines Rendering Performance
Igalia
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Nicolas HAAN
 
Apache Beam (incubating)
Apache Beam (incubating)Apache Beam (incubating)
Apache Beam (incubating)
Apache Apex
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Svetlin Nakov
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Trayan Iliev
 
Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fpHierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
Alexander Granin
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
National Cheng Kung University
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux
Trayan Iliev
 
Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production Debugging
Takipi
 
Behavior driven oop
Behavior driven oopBehavior driven oop
Behavior driven oop
Piyush Verma
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
Jeremy Grancher
 
Deep dive into Android async operations
Deep dive into Android async operationsDeep dive into Android async operations
Deep dive into Android async operations
Mateusz Grzechociński
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
Konstantin Loginov
 
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan GertisThe Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
HostedbyConfluent
 
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Sigma Software
 
Docker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline ExecutionDocker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline Execution
Brennan Saeta
 

Similar to LeakPair: Proactive Repairing of Leaks in Single Page Web Applications (20)

Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
 
Practicing at the Cutting Edge: Learning and Unlearning about Java Performance
Practicing at the Cutting Edge: Learning and Unlearning about Java PerformancePracticing at the Cutting Edge: Learning and Unlearning about Java Performance
Practicing at the Cutting Edge: Learning and Unlearning about Java Performance
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
 
Cross-platform UI Engines Rendering Performance
Cross-platform UI Engines Rendering PerformanceCross-platform UI Engines Rendering Performance
Cross-platform UI Engines Rendering Performance
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Apache Beam (incubating)
Apache Beam (incubating)Apache Beam (incubating)
Apache Beam (incubating)
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
 
Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fpHierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux
 
Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production Debugging
 
Behavior driven oop
Behavior driven oopBehavior driven oop
Behavior driven oop
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
Deep dive into Android async operations
Deep dive into Android async operationsDeep dive into Android async operations
Deep dive into Android async operations
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
 
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan GertisThe Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
 
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
Android App Architecture with modern libs in practice. Our way in R.I.D., Ser...
 
Docker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline ExecutionDocker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline Execution
 

More from Dongsun Kim

iFixR: Bug Report Driven Program Repair
iFixR: Bug Report Driven Program RepairiFixR: Bug Report Driven Program Repair
iFixR: Bug Report Driven Program Repair
Dongsun Kim
 
TBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairTBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program Repair
Dongsun Kim
 
Mining Fix Patterns for FindBugs Violations
Mining Fix Patterns for FindBugs ViolationsMining Fix Patterns for FindBugs Violations
Mining Fix Patterns for FindBugs Violations
Dongsun Kim
 
Learning to Spot and Refactor Inconsistent Method Names
Learning to Spot and Refactor Inconsistent Method NamesLearning to Spot and Refactor Inconsistent Method Names
Learning to Spot and Refactor Inconsistent Method Names
Dongsun Kim
 
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
Dongsun Kim
 
A Closer Look at Real-World Patches
A Closer Look at Real-World PatchesA Closer Look at Real-World Patches
A Closer Look at Real-World Patches
Dongsun Kim
 
LSRepair: Live Search of Fix Ingredients for Automated Program Repair
LSRepair: Live Search of Fix Ingredients for Automated Program RepairLSRepair: Live Search of Fix Ingredients for Automated Program Repair
LSRepair: Live Search of Fix Ingredients for Automated Program Repair
Dongsun Kim
 
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis ViolationsAVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
Dongsun Kim
 
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug LocalizationBench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Dongsun Kim
 
Impact of Tool Support in Patch Construction
Impact of Tool Support in Patch ConstructionImpact of Tool Support in Patch Construction
Impact of Tool Support in Patch Construction
Dongsun Kim
 
FaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search EngineFaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search Engine
Dongsun Kim
 
Augmenting and structuring user queries to support efficient free-form code s...
Augmenting and structuring user queries to support efficient free-form code s...Augmenting and structuring user queries to support efficient free-form code s...
Augmenting and structuring user queries to support efficient free-form code s...
Dongsun Kim
 
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
Dongsun Kim
 
Automatic Patch Generation Learned from Human-Written Patches
Automatic Patch Generation Learned from Human-Written PatchesAutomatic Patch Generation Learned from Human-Written Patches
Automatic Patch Generation Learned from Human-Written PatchesDongsun Kim
 

More from Dongsun Kim (14)

iFixR: Bug Report Driven Program Repair
iFixR: Bug Report Driven Program RepairiFixR: Bug Report Driven Program Repair
iFixR: Bug Report Driven Program Repair
 
TBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairTBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program Repair
 
Mining Fix Patterns for FindBugs Violations
Mining Fix Patterns for FindBugs ViolationsMining Fix Patterns for FindBugs Violations
Mining Fix Patterns for FindBugs Violations
 
Learning to Spot and Refactor Inconsistent Method Names
Learning to Spot and Refactor Inconsistent Method NamesLearning to Spot and Refactor Inconsistent Method Names
Learning to Spot and Refactor Inconsistent Method Names
 
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
 
A Closer Look at Real-World Patches
A Closer Look at Real-World PatchesA Closer Look at Real-World Patches
A Closer Look at Real-World Patches
 
LSRepair: Live Search of Fix Ingredients for Automated Program Repair
LSRepair: Live Search of Fix Ingredients for Automated Program RepairLSRepair: Live Search of Fix Ingredients for Automated Program Repair
LSRepair: Live Search of Fix Ingredients for Automated Program Repair
 
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis ViolationsAVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
 
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug LocalizationBench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
 
Impact of Tool Support in Patch Construction
Impact of Tool Support in Patch ConstructionImpact of Tool Support in Patch Construction
Impact of Tool Support in Patch Construction
 
FaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search EngineFaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search Engine
 
Augmenting and structuring user queries to support efficient free-form code s...
Augmenting and structuring user queries to support efficient free-form code s...Augmenting and structuring user queries to support efficient free-form code s...
Augmenting and structuring user queries to support efficient free-form code s...
 
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote,...
 
Automatic Patch Generation Learned from Human-Written Patches
Automatic Patch Generation Learned from Human-Written PatchesAutomatic Patch Generation Learned from Human-Written Patches
Automatic Patch Generation Learned from Human-Written Patches
 

Recently uploaded

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
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
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 

Recently uploaded (20)

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
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
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 

LeakPair: Proactive Repairing of Leaks in Single Page Web Applications

  • 1. LeakPair: Proactive Repairing of Leaks in Single Page Web Applications Arooba Shahoor Kyungpook National University, Korea Askar Yeltayuly Khamit UNIST, Korea Jooyong Yi UNIST, Korea Dongsun Kim Kyungpook National University, Korea The 38th IEEE/ACM International Conference on Automated Software Engineering (ASE 2023) 14 September 2023 with ACM Distinguished Paper Award
  • 2. 2
  • 3.
  • 5. Why Are Memory Leaks Critical in the SPA Architecture? 5
  • 6. Client Page switching with reload User Interface Page 1 Page 2 Page 3 HTTP Request for initial page load HTTP Request for page transition Server <template> Presentation Layer Database & Business Logic Multi Page Application Architecture 6 New page for each request Inside the Heap Object 3 Object 2 Object 4 Object 1 Allocated objects from previous page all wiped off On user interactions
  • 7. Client No reload required SPA Framework (Angular/React/Vue..) Single .html file <template 1> <template 2> <template 3> View switching without reload User Interface View 1 View 2 View 3 HTTP Request for initial page load AJAX Request for page transition Server Single Page Application Architecture 7 Database & Business Logic Object 3 Object 4 Object 2 Object 1 Object 6 Object 5 This page is never refreshed… On user interactions Inside the Heap Unintentional references will keep piling up! Object 7 Object 8 Object 9
  • 8. JavaScript Devs Can’t Rely on Garbage Collectors
  • 9. Garbage Collection in JS (Mark and Sweep) Reachability from Root Object 4 Object 5 Object 2 Object 8 Object 6 Object 7 Object 3 Object 1 View 1 (Inside Heap) window (GC ROOT 1) String (GC ROOT 2)
  • 10. Garbage Collection in JS (Mark and Sweep) Reachability from Root Object 4 Object 5 Object 2 Object 8 UNUSED Object 7 UNUSED Object 1 View 2 (Inside Heap) UNUSED UNUSED window (GC ROOT 1) String (GC ROOT 2)
  • 11. Garbage Collection in JS (Mark and Sweep) Reachability from Root UNUSED MARK Object 5 MARK Object 2 MARK UNUSED MARK UNUSED MARK Object 7 SWEEP UNUSED MARK Object 1 MARK View 2 (Inside Heap) Unused objects marked as alive and will not be GC’ed, due to reachability from GC root window (GC ROOT 1) String (GC ROOT 2)
  • 12. Garbage Collection in JS (Mark and Sweep) Reachability from Root UNUSED MARK Object 5 MARK Object 2 MARK UNUSED MARK UNUSED MARK UNUSED MARK Object 1 MARK View 2 (Inside Heap) window (GC ROOT 1) String (GC ROOT 2)
  • 13. Garbage Collection in JS (Mark and Sweep) Reachability from Root UNUSED Object 5 Object 2 UNUSED UNUSED UNUSED Object 1 View 3 (Inside Heap) window (GC ROOT 1) String (GC ROOT 2) New object 1 New object 2 Lingering unwanted objects will keep gobbling up available space for newer objects New object 3
  • 14. 14 Case in Point Memory Leak in MS Rooster [2] Reachable from root The fix
  • 15. Leak Detection in JS Automation Efforts (2015-2022) 2015. MemInsight [3] Reports stale objects, by computing object lifetimes. 2016. LeakSpot [4] Reports all allocation and reference sites of leaked objects. 2018. Bleak [5] Identifies and reports leaked objects by running the website in a headless browser. 2022. Memlab [7] Reports retainer traces of leaked objects by running the website in a headless browser. 15
  • 16. MemInsight LeakSpot Bleak Memlab The Problem With Automated Detection Tools 16 Based on staleness criteria + report leak-related data rather than actual leak locations Bleak Takes at least 10 mins to execute Memlab Reported retainer traces contain metadata and internal objects, making root cause detection arduous Require manually-written scenario file
  • 17. State of the Art ● Manual diagnosis via heap snapshots ● Three snapshot technique ● First introduced by Gmail team in 2012 ● Detecting root cause can be laborious and inaccurate 17
  • 20. Proactive strategy ● Patches that are simple, non-intrusive and recurring. ● Enable repairs before fault localization. ● Avoiding detection step is a huge advantage. Based on fix patterns [1]. 20 [1] D. Kim, J. Nam, J. Song, and S. Kim, “Automatic Patch Generation Learned from Human-written Patches,” in Proceedings of the 2013 International Conference on Software Engineering, in ICSE ’13. Piscataway, NJ, USA: IEEE Press, 2013, pp. 802–811.
  • 21. Leak Pattern Mining ● Search targets: GitHub and Stack Overflow. ● Reported at least 5 times. ● Acknowledged by at least 2 developers. ● Replicable and testable. 21
  • 22. Fix Pattern Mining ● Stack Overflow answers accepted in at least 2 posts. ● GitHub commits merged in at least 2 projects. ● Verified by comparing memory footprints before and after. 22
  • 23. 4 Leaks and (Corresponding) Fix Patterns 23
  • 24. 1. Uncleared Timing Events (setTimeout and setInterval) { … setTimeOut(() => {...}) … } { … setTimeOut(() => {...}) timeOutID = setTimeOut(() => {...}) ... destructorMethodDeclaration() { ... clearTimeOut(timeOutID) } } If component unmounts before time, these events will still execute, retaining references of all enclosing objects. Fix Pattern Leak Pattern Other leak patterns 2. Unreleased subscription 3. Unremoved event listener 4. Uncanceled animation frame request 24
  • 25. Applying Fix Patterns SPA project Identify JS file(s) Transform to AST Find leak pattern matches Match found? Apply fix to AST Yes Convert back to source
  • 27. Research Questions RQ1. Effectiveness How effective is the tool at minimizing memory leaks? RQ2. Acceptance How useful are generated patches, as perceived by developers? RQ3. Correctness What is the impact of our tool on test suite execution results? 27
  • 28. Subjects Known leaks Leaks already detected and fixed by developers. Unknown leaks Leaks developers were not aware of. 10 open source SPA projects with already known memory leaks: Microsoft’s Rooster, Fundamental Library for Angular, Material UI… 10 projects with unfound leaks at the time of evaluation: Angular Extentions Elements, react-multi-carousel, ngx-bootstrap… 28
  • 29. 29 Effectiveness Evaluation (RQ 1) Compare before and after footprints Execute Memlab (10 Iterations) Note memory footprints SPA subject LEAKPAIR Execute LeakPair Run the SPA Subject Scenario file (10 Loops) Note memory footprints again
  • 30. 30 Effectiveness Evaluation (RQ 1) Compare before and after footprints Execute Memlab (10 Iterations) Note memory footprints SPA subject LEAKPAIR Execute LeakPair Run the SPA Subject Scenario file (10 Loops) Note memory footprints again
  • 31. Compare before and after footprints 31 Acceptance Evaluation (RQ 2) Is heap size or leak count reduced? Yes Is unknown leak? Yes Submit fix as PR Track PR status
  • 32. 32 Correctness Evaluation (RQ 3) Execute test suite (If available) SPA subject LEAKPAIR Execute LeakPair Run the SPA Subject Note build/ compile time Note passing/failing test cases Note build/compile time and test case results again Compare before and after test cases results and execution times
  • 34. Effectiveness (RQ 1) ● 8 of 10 subjects with known leaks had noticeable heap reductions. ● 7 of 10 subjects with unknown leaks had significant heap reductions (4 -18%). ● All subjects had memory leak reductions. 34 LeakPair patches can successfully prevent leaks and reduce heap, without leak detection.
  • 35. Acceptance (RQ 2) ● Total = 20 pull requests ● Agreed = 12 (60%) Merged Approved Improved Ignored 9 2 1 8 35 LeakPair patches are acceptable to developers, with more than half of patch suggestions being accepted.
  • 36. Correctness (RQ 3) ● Successful build/compilation ● Count of passing/failing test cases of 10 of 10 unchanged ● Execution times before and after LP execution shared the same range for all 10 projects 36 LeakPair patches are non-intrusive; they neither break functionality, nor incur execution time delays.