Modern web applications often resort to application development frameworks such as React, Vue.js, and Angular. While the frameworks facilitate the development of web applications with several useful components, they are inevitably vulnerable to unmanaged memory consumption since the frameworks often produce Single Page Applications (SPAs). Web applications can be alive for hours and days with behavior loops, in such cases, even a single memory leak in a SPA app can cause performance degradation on the client side. However, recent debugging techniques for web applications still focus on memory leak detection, which requires manual tasks and produces imprecise results. We propose LeakPair, a technique to repair memory leaks in single page applications. Given the insight that memory leaks are mostly non-functional bugs and fixing them might not change the behavior of an application, the technique is designed to proactively generate patches to fix memory leaks, without leak detection, which is often heavy and tedious. To generate effective patches, LeakPair follows the idea of pattern-based program repair since the automated repair strategy shows successful results in many recent studies. We evaluate the technique on more than 20 open-source projects without using explicit leak detection. The patches generated by our technique are also submitted to the projects as pull requests. The results show that LeakPair can generate effective patches to reduce memory consumption that are acceptable to developers. In addition, we execute the test suites given by the projects after applying the patches, and it turns out that the patches do not cause any functionality breakage; this might imply that LeakPair can generate non-intrusive patches for memory leaks.
翻译:现代Web应用通常依赖React、Vue.js和Angular等应用开发框架。尽管这些框架通过提供多种实用组件简化了Web应用的开发,但由于其常生成单页应用(SPA),不可避免地存在未受管理的内存消耗漏洞。Web应用可能因行为循环而持续运行数小时甚至数天,此时SPA应用中的单个内存泄漏就可能导致客户端性能下降。然而,当前Web应用的调试技术仍侧重于内存泄漏检测,这需要人工操作且结果不精确。我们提出LeakPair技术用于修复单页应用中的内存泄漏。基于"内存泄漏大多为非功能性缺陷,修复后不会改变应用行为"这一洞察,该技术被设计为无需经过通常繁琐耗时的泄漏检测,即可主动生成补丁修复内存泄漏。为生成有效补丁,LeakPair采用基于模式的程序修复策略——这种自动化修复方法已在近期多项研究中取得显著成效。我们在未使用显式泄漏检测的情况下,对20多个开源项目进行了技术评估。由该技术生成的补丁已作为拉取请求提交至对应项目。结果表明,LeakPair能生成被开发者接受的有效补丁以降低内存消耗。此外,我们在应用补丁后执行项目自带的测试套件,证实补丁未导致任何功能破坏,这或许意味着LeakPair能为内存泄漏生成非侵入式补丁。