plasma-umass / BLeak

BLeak: Automatically Debugging Memory Leaks in Web Applications
MIT License
408 stars 41 forks source link

Help: No stack traces recorded! #34

Open hcg2008 opened 6 years ago

hcg2008 commented 6 years ago

bleak viewer

found leak!

LeakShare 8000280 x within closure of window.VUE_HOT_MAP["data-v-ed7ab756"].options.data

No stack traces recorded! This could indicate a bug in BLeak. If your application is publicly available, please file a bug report on GitHub with your configuration file so we can look into the problem.

============================ bleak run

bleak run --config bleak_config-1.js --out ./output/ --snapshot

DevTools listening on ws://127.0.0.1:51565/devtools/browser/afe893c6-bf9f-4f77-9ebb-9c9b16c15112 2018-09-09 22:03:55.098 Google Chrome[7342:184561] *** Owner supplied to -[NSTrackingArea initWithRect:options:owner:userInfo:] referenced a deallocating object. Tracking area behavior is undefined. Break on NSTrackingAreaDeallocatingOwnerError to debug. [ ] 1% [1/116] 0.0s (ETA 0.1s) Navigating to http://127.0.0.1:3000/(node:7334) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. at showFlaggedDeprecation (buffer.js:160:11) at new Buffer (buffer.js:175:3) at embedSourceMap (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/closure_state_transform.js:1955:74) at tryJSTransform (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/closure_state_transform.js:1989:16) at Object.ensureES5 (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/closure_state_transform.js:2039:12) at log.timeEvent (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/mitmproxy_interceptor.js:138:77) at ProgressProgressBar.timeEvent (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/progress_progress_bar.js:81:20) at interceptor (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/mitmproxy_interceptor.js:137:29) at log.timeEvent (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/mitmproxy_interceptor.js:147:13) at ProgressProgressBar.timeEvent (/Volumes/Customer/MyProject/NodeJS/BLeak/dist/node/lib/progress_progress_bar.js:81:20) [====================] 100% [116/116] 41.1s (ETA 0.0s) Retrieving stack traces Results can be found in ./output/

============================= bleak find-growing-paths

bleak find-growing-paths output/snapshots/leak_detection/snapshot_0.heapsnapshot.gz output/snapshots/leak_detection/snapshot_1.heapsnapshot.gz output/snapshots/leak_detection/snapshot_2.heapsnapshot.gz output/snapshots/leak_detection/snapshot_3.heapsnapshot.gz Processing output/snapshots/leak_detection/snapshot_0.heapsnapshot.gz... Processing output/snapshots/leak_detection/snapshot_1.heapsnapshot.gz... Processing output/snapshots/leak_detection/snapshot_2.heapsnapshot.gz... Processing output/snapshots/leak_detection/snapshot_3.heapsnapshot.gz... Time to run Get Growing Objects: 0.109 seconds. Found 2 growing paths.

Report

jvilk commented 6 years ago

Thanks for filing the bug. Is the application that you have run BLeak on open source or could you make it available to me somehow? I'm guessing there is a bug in BLeak's JavaScript rewriting process that misses this variable somehow.

hcg2008 commented 6 years ago

Thanks!

I run a example from https://github.com/sdras/sample-vue-shop.git.

1.

In the example, I created a leak by adding following code to pages/women.vue.

var x = [];

function grow() { x.push(new Array(2000000).join('x')); } and adding grow(); in computed: { wProducts() { grow(); return ..... It will leak 2M memory each loop.

  1. the config script:

    exports.url = "http://127.0.0.1:3000/";

exports.loop = [ // First state { check: function() { return !!document.getElementsByTagName('img'); }, // check: function() { return document.getElementsByTagName('img')[4].src == "http://127.0.0.1:3000/hat1.png"; }, next: function() { document.getElementsByTagName('li')[0].click(); } }, { check: function() { return !!document.getElementsByTagName('img'); }, // check: function() { return document.getElementsByTagName('img')[4].src == "http://127.0.0.1:3000/jacket3.png"; }, next: function() { document.getElementsByTagName('li')[1].click(); } }, { check: function() { return !!document.getElementsByTagName('img'); }, // check: function() { return document.getElementsByTagName('img')[4].src == "http://127.0.0.1:3000/sweater2.png"; }, next: function() { document.getElementsByTagName('a')[0].click(); } }, ];

// (Optional) Number of loop iterations to perform during leak detection (default: 8) exports.iterations = 4;

3.

I changed the file bleak_agents.ts by replacing all xxxxx.hasOwnProperty() with Object.prototype.hasOwnProperty.call() because I got "Uncaught TypeError"