plasma-umass / bleak Goto Github PK
View Code? Open in Web Editor NEWBLeak: Automatically Debugging Memory Leaks in Web Applications
License: MIT License
BLeak: Automatically Debugging Memory Leaks in Web Applications
License: MIT License
Hi, I am trying get this running, however there seems to be a missing bleak_agent_transform.js
file.
$ node build/src/frontends/bleak.js --config config.js --out ./out
MITMProxy not running; starting up mitmproxy.
Loading script: /home/rhalff/git/rhalff/BLeak/node_modules/mitmproxy/scripts/proxy.py
Proxy server listening at http://0.0.0.0:8080
127.0.0.1:40574: clientconnect
127.0.0.1:40576: clientconnect
127.0.0.1:40574: clientdisconnect
127.0.0.1:40576: clientdisconnect
127.0.0.1:40582: clientconnect
{ Error: ENOENT: no such file or directory, open '/home/rhalff/git/rhalff/BLeak/build/src/lib/bleak_agent_transform.js'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)
at Object.getInterceptor (/home/rhalff/git/rhalff/BLeak/build/src/lib/mitmproxy_interceptor.js:37:37)
at Object.configureProxy (/home/rhalff/git/rhalff/BLeak/build/src/common/util.js:10:40)
at BLeakDetector.configureProxy (/home/rhalff/git/rhalff/BLeak/build/src/lib/bleak.js:92:23)
at new BLeakDetector (/home/rhalff/git/rhalff/BLeak/build/src/lib/bleak.js:61:14)
at Function.<anonymous> (/home/rhalff/git/rhalff/BLeak/build/src/lib/bleak.js:71:30)
at Generator.next (<anonymous>)
at /home/rhalff/git/rhalff/BLeak/build/src/lib/bleak.js:7:71
at new Promise (<anonymous>)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/rhalff/git/rhalff/BLeak/build/src/lib/bleak_agent_transform.js' }
Hi,
Greetings from the @mitmproxy team. I just stumbled upon BLeak by accident (someone mentioned it in our user survey), and I'm excited to see what you've done with mitmproxy here. Thank you for actually citing us, which sometimes unfortunately isn't the case. We're always happy to support academic research, so if you have any questions please feel free to drop by in our Slack or GitHub repo. Also, I'd be more than happy to have you on https://mitmproxy.org/publications/ if you want to add yourself - link is on the page. ๐
Hi,
I'm trying to use BLeak and have a crash which keeps happening around the middle (52%) of a run.
The error message I get looks like this, and it looks like it's coming from Chrome:
http://localhost:4200/bleak_agent.js:62:38 Uncaught RangeError: Maximum call stack size exceeded
at $$$CREATE_SCOPE_OBJECT$$$ (http://localhost:4200/bleak_agent.js:63:39)
at Function.<anonymous> (http://localhost:4200/polyfills.js:4752:22)
at $$$CREATE_SCOPE_OBJECT$$$ (http://localhost:4200/bleak_agent.js:76:23)
at Function.<anonymous> (http://localhost:4200/polyfills.js:4752:22)
at $$$CREATE_SCOPE_OBJECT$$$ (http://localhost:4200/bleak_agent.js:76:23)
at Function.<anonymous> (http://localhost:4200/polyfills.js:4752:22)
at $$$CREATE_SCOPE_OBJECT$$$ (http://localhost:4200/bleak_agent.js:76:23)
at Function.<anonymous> (http://localhost:4200/polyfills.js:4752:22)
at $$$CREATE_SCOPE_OBJECT$$$ (http://localhost:4200/bleak_agent.js:76:23)
at Function.<anonymous> (http://localhost:4200/polyfills.js:4752:22)
undefined
$$$CREATE_SCOPE_OBJECT$$$ at http://localhost:4200/bleak_agent.js:62:38
http://localhost:4200/polyfills.js:4751:21
$$$CREATE_SCOPE_OBJECT$$$ at http://localhost:4200/bleak_agent.js:75:22
http://localhost:4200/polyfills.js:4751:21
...
$$$CREATE_SCOPE_OBJECT$$$
in bleak_agent.js looks like this:
function $$$CREATE_SCOPE_OBJECT$$$(parentScopeObject, movedVariables,
unmovedVariables, args, argValues) {
movedVariables.concat(args).forEach((varName) => {
unmovedVariables[varName] = {
value: undefined,
enumerable: true,
writable: true,
configurable: true
};
});
// Initialize arguments.
args.forEach((argName, i) => {
unmovedVariables[argName].value = argValues[i];
});
return Object.create(parentScopeObject, unmovedVariables);
}
From devtools in the Chrome instance, the function at polyfills.js:4752 looks like this:
Object.create = $$$FUNCTION_EXPRESSION$$$(function (obj, proto) {
var s136 = $$$CREATE_SCOPE_OBJECT$$$(s87, [], {}, ["obj", "proto"], [obj, proto]);
if ($$$SEQ$$$(typeof s136.proto, 'object') && !Object.isFrozen(s136.proto)) {
Object.keys(s136.proto).forEach($$$FUNCTION_EXPRESSION$$$(function (prop) {
s136.proto[prop] = (s87.rewriteDescriptor || s87.rewriteDescriptor)(s136.obj, prop, s136.proto[prop]);
}, s136));
}
return (s87._create || s87._create)(s136.obj, s136.proto);
}, s87);
It appears that Object.create
calls $$$CREATE_SCOPE_OBJECT$$$
and vice versa, and that this recursive calling is causing the call stack to exceed.
If it helps, the pre-transformed version of Object.create
looks like this:
Object.create = function (obj, proto) {
if (typeof proto === 'object' && !Object.isFrozen(proto)) {
Object.keys(proto).forEach(function (prop) {
proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
});
}
return _create(obj, proto);
};
A quick google shows that the function is actually from zone.js in our Angular application.
Any help on this would be highly appreciated! Any leaks that you can help us find would be majorly helpful.
We require mitmproxy and a few Python packages to be installed.
Perhaps modify my mitmproxy NPM package to fail installing should these items be missing, and include instructions in BLeak / mitmproxy NPM package describing how to install these dependencies.
// URL to the web application.
exports.url = "http://localhost:4200";
// Runs your program in a loop. Each item in the array is a `state`. Each `state` has a "check"
// function, and a "next" function to transition to the next state in the loop. These run
// in the global scope of your web app.
// BLeak assumes that the app is in the first state when it navigates to the URL. If you specify
// optional setup states, then it assumes that the final setup state transitions the web app to
// the first state in the loop.
// The last state in the loop must transition back to the first.
exports.loop = [
// First state
{
// Return 'true' if the web application is ready for `next` to be run.
check: function() {
// Example: `group-listing` must be on the webpage
console.logt("====>", document.getElementsByTagName('app-root')[0]);
return !!document.getElementsByTagName('app-root')[0];
},
// Transitions to the next state.
next: function() {
// Example: Navigate to the first thread
//document.getElementById("thread-001").click();
document.location.assign("http://localhost:4200/settings")
}
},
// Second (and last) state
{
check: function() {
// Example: Make sure the body of the thread has loaded.
return !!document.querySelector("app-shell mat-sidenav-container mat-sidenav-content td-layout-nav span span");
},
// Since this is the last state in the loop, it must transition back to the first state.
next: function() {
// Example: Click back to group listing
document.querySelector("app-shell mat-sidenav-container mat-sidenav-content td-layout-nav span span").click();
}
}
];
// (Optional) Number of loop iterations to perform during leak detection (default: 8)
exports.iterations = 1;
// (Optional) An array of states describing how to login to the application. Executed *once*
// to set up the session. See 'config.loop' for a description of a state.
/*exports.login = [
{
check: function() {
// Return 'true' if the element 'password-field' exists.
return !!document.getElementById('password-field');
},
next: function() {
// Log in to the application.
const pswd = document.getElementById('password-field');
const uname = document.getElementById('username-field');
const submitBtn = document.getElementById('submit');
uname.value = 'spongebob';
pswd.value = 'squarepants';
submitBtn.click();
}
}
];*/
// (Optional) An array of states describing how to get from config.url to the first state in
// the loop. Executed each time the tool explicitly re-navigates to config.url. See
// config.loop for a description of states.
exports.setup = [
];
// (Optional) How long (in milliseconds) to wait for a state transition to finish before declaring an error.
// Defaults to 10 minutes
exports.timeout = 10* 60 *1000;//1000; //10 * 60 * 1000;
// (Optional) How long (in milliseconds) to wait between a check() returning 'true' and transitioning to the next step or taking a heap snapshot.
// Default: 1000
exports.postCheckSleep = 1000;
// (Optional) How long (in milliseconds) to wait between transitioning to the next step and running check() for the first time.
// Default: 0
exports.postNextSleep = 10;
// (Optional) How long (in milliseconds) to wait between submitting login credentials and reloading the page for a run.
// Default: 5000
//exports.postLoginSleep = 5000;
// (Optional) An array of numerical IDs identifying leaks with fixes in your code. Used to
// evaluate memory savings with different leak configurations and the effectiveness of bug fixes.
// In the code, condition the fix on $$$SHOULDFIX$$$(ID), or add logic to `exports.rewrite` (see below),
// and BLeak will run the web app with the fixes applied.
exports.fixedLeaks = [0, 1, 2];
// (Optional) Proxy re-write rule that runs in a Node.js environment, *not* in the browser.
// Lets you rewrite the web app's JavaScript/HTML/CSS to test bug fixes. Especially useful for evaluating
// fixes on web apps you do not control.
// Return a Node.js Buffer containing the replacement resource contents, or the original contents if not
// modifying.
exports.rewrite = function(url /* URL of the resource */,
type /* MIME type of resource */,
data /* Contents of resource, as a Node.js Buffer */,
fixes /* Array of numerical IDs corresponding to bug fixes that are active during the session (see fixedLeaks) */) {
function hasFix(n) {
return fixes.indexOf(n) !== -1;
}
// Example: Filter out non-JavaScript resources.
if (type.indexOf("javascript") !== -1) {
if (url.indexOf("19/common.js") !== -1) {
let src = data.toString();
// Example: Replace a specific string in `19/common.js` to fix bug 0.
if (hasFix(0)) {
src = src.replace(`window.addEventListener("scroll",a,!1)`, 'window.onscroll=a');
}
return Buffer.from(src, 'utf8');
}
}
return data;
};
Hi,
I have installed python 3.7 and mitmproxy.
I have set up a config file to test my site when I run bleak it generates the output folder and copies in the config file and then nothing else happens.
I then configured a second config to open a 3rd party site and the same thing happens.
any tips on debugging what is happening would be appreciated
exports.url = "http://www.ocgov.com";
// Runs your program in a loop. Each item in the array is a state
. Each state
has a "check"
// function, and a "next" function to transition to the next state in the loop. These run
// in the global scope of your web app.
// BLeak assumes that the app is in the first state when it navigates to the URL. If you specify
// optional setup states, then it assumes that the final setup state transitions the web app to
// the first state in the loop.
// The last state in the loop must transition back to the first.
exports.loop = [
// First state
{
// Return 'true' if the web application is ready for next
to be run.
check: function() {
// Example: group-listing
must be on the webpage
return !!document.getElementById('imgPopMenu3');
},
// Transitions to the next state.
next: function() {
// Example: Navigate to the first thread
document.getElementById("imgPopMenu3").click();
}
},
// Second (and last) state
{
check: function() {
// Example: Make sure the body of the thread has loaded.
return !!document.getElementById('imgPopMenu2');
},
// Since this is the last state in the loop, it must transition back to the first state.
next: function() {
// Example: Click back to group listing
document.getElementById('imgPopMenu2').click();
}
}
];
yarn run bleak run --config C:\Users\dange\bleak\ocgov.config.js --out C:\Users\dange\bleak\bleak_ocgog
Environment: Mac OSX High Sierra
Python versions - python : 2.7.0 and python3 : 3.7.0
Mitmproxy : 4.0.1 (This is using python 3.7)
Bleak was installed from npm
Command : bleak run --config bleak_config.js --out bleak
config file (in txt because of github restrictions) is attached (jquery.min.js has been copy-pasted at the top. Actual config starts from line 17)
config.txt
BLeaks opens the browser which displays the following (while accessing localhost:8080):
502 Bad Gateway
ProtocolException("Invalid server address: ('localhost', 8080)\r\nThe proxy shall not connect to itself.")
On terminal it throws the following error:
DevTools listening on ws://127.0.0.1:49277/devtools/browser/e20ca5ea-a43f-40d2-9e72-91cb461810a4
2018-08-11 12:43:53.148 Google Chrome[70488:2536413] *** Owner supplied to -[NSTrackingArea initWithRect:options:owner:userInfo:] referenced a deallocating object. Tracking area behavior is undefined. Break on NSTrackingAreaDeallocatingOwnerError to debug.
2018-08-11 12:43:53.436 Google Chrome[70488:2536413] Errors logged by ksadmin: KSKeyedPersistentStore store directory does not exist. [com.google.UpdateEngine.CommonErrorDomain:501 - '/Library/Google/GoogleSoftwareUpdate/TicketStore' - 'KSKeyedPersistentStore.m:327']
KSPersistentTicketStore failed to load tickets. (productID: com.google.Chrome) [com.google.UpdateEngine.CoreErrorDomain:1051 - '/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore'] (KSKeyedPersistentStore store directory does not exist. - '/Library/Google/GoogleSoftwareUpdate/TicketStore' [com.google.UpdateEngine.CommonErrorDomain:501])
ksadmin cannot access the ticket store:<KSUpdateError:0x7fc27f60ffa0
domain="com.google.UpdateEngine.CoreErrorDomain"
code=1051
userInfo={
function = "-[KSProductKeyedStore(ProtectedMethods) errorForStoreError:productID:message:timeoutMessage:]";
date = 2018-08-11 07:13:53 +0000;
productids = {(
"com.google.Chrome"
)};
filename = "KSProductKeyedStore.m";
line = 102;
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore";
NSUnderlyingError = <KSError:0x7fc2813068d0
domain="com.google.UpdateEngine.CommonErrorDomain"
code=501
userInfo={
NSLocalizedDescription = "KSKeyedPersistentStore store directory does not exist.";
line = 327;
filename = "KSKeyedPersistentStore.m";
function = "-[KSKeyedPersistentStore(PrivateMethods) validateStorePath]";
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore";
date = 2018-08-11 07:13:53 +0000;
}
>;
NSLocalizedDescription = "KSPersistentTicketStore failed to load tickets.";
}
>
Error: socket disconnect
[= ] 6% [3/48] 0.1s (ETA 1.0s) Waiting for loop[0].check() === true
BLeak's viewer uses the Ace Editor to display source code, and uses Ace Editor's markers to highlight source locations that contribute to memory leaks. These markers drift to the right on long lines, causing the highlight to fall on incorrect characters.
I have triple checked the markers that BLeak is issuing to the Ace Editor, as well as the offset in the line, and have verified that this is an issue in the Ace Editor. The source lines contain no funky unicode characters, so number of characters making up the offset is equal to the byte length of the line expressed as UTF8.
The Ace Editor calculates the pixel location of a marker by multiplying the width of a monospace font character with the offset. It seems like there is some error accumulating over each character, causing the markers to drift on long offsets.
This might be related to #14 but I'm not sure. I tried BLeak on a site, and it seemed to get through the first phase of loading the site in a loop and collecting heap snapshots. But at the "Diagnosing leaks" phase (where I think it does JS instrumentation) the site doesn't load and I get a JS error Uncaught TypeError: Cannot read property 'defineProperty' of undefined
. Unfortunately this is not a public site so I can't share code / repro steps. Two questions:
Regarding #14, I do not see any bleak_results.json
in my output directory at the point the JS error appears.
MITMProxy 3 was recently released, and has a slightly different plugin API. We should upgrade at some point.
I run into the following issue when installing bleak-detector:
$ npm install -g bleak-detector
C:\Users\username\AppData\Roaming\npm\bleak ->
C:\Users\username\AppData\Roaming\npm\node_modules\bleak-detector\dist\node\cli\bleak.js
[email protected] install C:\Users\username\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\bufferutil
prebuild-install || node-gyp rebuild
[email protected] install C:\Users\username\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\utf-8-validate
prebuild-install || node-gyp rebuild
[email protected] postinstall C:\Users\username\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\mitmproxy
scripts/install_python_deps.py
'scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: scripts/install_python_deps.py
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache_logs\2018-10-26T06_07_20_186Z-debug.log
$ mitmdump --version
Mitmproxy: 4.0.4 binary
Python: 3.6.6
OpenSSL: OpenSSL 1.1.0i 14 Aug 2018
Platform: Windows-10-10.0.16299
$ python -V
Python 3.7.1
I see the same problems when running npm install -g mitmproxy. Also for earlier version 2.0.4
As an alternative, I also tried to use yarn, but that resulted in the same issue.
Do you have any suggestion how to proceed with this?
First, congrats on creating BLeak, this is such a wonderful and helpful software :)
I ran into an issue when using recursive function calls in the instrumented JavaScript code.
The issue is with an old version of the jQuery (haven't checked a newer version).
The original code causing the issue is:
add: function() {
if ( list ) {
// If we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jQuery.each( args, function( _, arg ) {
if ( jQuery.isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
// Inspect recursively
// !!! This is where the error happens !!!
add( arg );
}
} );
} )( arguments );
if ( memory && !firing ) {
fire();
}
}
return this;
},
The instrumented code is as follows:
s31.self = {
add: $$$FUNCTION_EXPRESSION$$$(function () {
if (s31.list) {
if (s31.memory && !s31.firing) {
s31.firingIndex = s31.list.length - 1;
s31.queue.push(s31.memory);
}
$$$FUNCTION_EXPRESSION$$$(function add(args) {
var s32 = $$$CREATE_SCOPE_OBJECT$$$(s31, ["add"], {}, [], []);
s1.jQuery.each(args, $$$FUNCTION_EXPRESSION$$$(function (_, arg) {
if (s1.jQuery.isFunction(arg)) {
if (!s31.options.unique || !s31.self.has(arg)) {
s31.list.push(arg);
}
} else if (arg && arg.length && !$$$SEQ$$$(s1.jQuery.type(arg), "string")) {
// !!! This is where the error happens !!!
(s32.add || s32.add)(arg);
}
}, s32));
}, s31)(arguments);
if (s31.memory && !s31.firing) {
(s31.fire || s31.fire)();
}
}
return this;
}, s31),
I was able to work around the issue by rewriting the function so that the instrumented code becomes:
s31.self = {
add: $$$FUNCTION_EXPRESSION$$$(function () {
var s32 = $$$CREATE_SCOPE_OBJECT$$$(s31, ["add2", "callAdd2"], {}, [], []);
if (s31.list) {
if (s31.memory && !s31.firing) {
s31.firingIndex = s31.list.length - 1;
s31.queue.push(s31.memory);
}
s32.add2 = $$$FUNCTION_EXPRESSION$$$(function (args) {
s1.jQuery.each(args, $$$FUNCTION_EXPRESSION$$$(function (_, arg) {
if (s1.jQuery.isFunction(arg)) {
if (!s31.options.unique || !s31.self.has(arg)) {
s31.list.push(arg);
}
} else if (arg && arg.length && !$$$SEQ$$$(s1.jQuery.type(arg), "string")) {
(s32.callAdd2 || s32.callAdd2)(arg);
}
}, s32));
}, s32);
s32.callAdd2 = $$$FUNCTION_EXPRESSION$$$(function (args) {
(s32.add2 || s32.add2)(args);
}, s32);
(s32.add2 || s32.add2)(arguments);
if (s31.memory && !s31.firing) {
(s31.fire || s31.fire)();
}
}
return this;
}, s31),
This is not blocking me anymore, but other people may run into similar issues.
Please let me know if I can provide anything else to help solve this issue.
When a precondition or a transition function fails with an exception, BLeak doesn't print that information clearly to the console. Instead, it dies horrifically and ambiguously.
Let's fix that.
OS Mac OSX
Whenever I try to install the package globally via NPM. I get this error
$ npm install -g bleak-detector
> [email protected] preinstall /Users/apple/.nvm/versions/node/v10.17.0/lib/node_modules/bleak-detector/node_modules/chrome-devtools-frontend
> if [ -z ${PUPPETEER_SKIP_CHROMIUM_DOWNLOAD+x} ]; then echo 'Run npm run install-deps instead' && exit 1; fi
Run npm run install-deps instead
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `if [ -z ${PUPPETEER_SKIP_CHROMIUM_DOWNLOAD+x} ]; then echo 'Run npm run install-deps instead' && exit 1; fi`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
Keeping in mind that i'm currently using 3.7 and have installed mitmproxy
. Any idea why this happens ?
I was trying to run headless.
Found a typo in the chrome_driver.ts
BLeak/src/lib/chrome_driver.ts
Line 50 in b920f79
BLeak produces a text log that describes all of the memory leaks it finds, but it would be much more useful to display these in a simple web frontend that shows the source code associated with each stack trace (e.g., in a CodeMirror editor). BLeak saves all of the original source files in the output directory, so (AFAIK) it already collects all of the data required to do this.
When the browser is in the background, BLeak runs sometimes fail. This happens even on our unit tests.
I have no idea why at the moment; we wait until the application is in a proper state to take a heap snapshot, so this should not be caused by Chrome's internal throttling. I need to dig into the heap snapshots taken during a failing run to see if properties are arbitrarily missing.
In larger applications, failures sometimes occur in headless mode, but that might be due to nondeterminism / missing preconditions for a state.
MacOs High Sierra 10.13.6
a very simaple config for testing:
exports.url = "http://192.168.0.83/";
exports.loop = [
// First state
{
// Return 'true' if the web application is ready for next
to be run.
check: function() {
return !!document.getElementsByTagName('BUTTON');
},
// Transitions to the next state.
next: function() {
document.getElementsByTagName('BUTTON')[0].click();
}
},
// Second (and last) state
{
check: function() {
// Example: Make sure the body of the thread has loaded.
return !!document.getElementById('thread-body');
},
// Since this is the last state in the loop, it must transition back to the first state.
next: function() {
// Example: Click back to group listing
document.getElementById('group-001').click();
}
}
];
./bleak run --config ../bleak_config.js --out ../output/
DevTools listening on ws://127.0.0.1:63740/devtools/browser/fbfe026b-7624-4d4a-a809-98bbf9c8f87d
2018-09-04 14:16:21.115 Google Chrome[19904:5241419] *** Owner supplied to -[NSTrackingArea initWithRect:options:owner:userInfo:] referenced a deallocating object. Tracking area behavior is undefined. Break on NSTrackingAreaDeallocatingOwnerError to debug.
[ ] 1% [1/136] 0.0s (ETA 0.0s) Navigating to http://192.168.0.83/(node:19894) [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:159:11)
at new Buffer (buffer.js:174:3)
at embedSourceMap (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/closure_state_transform.js:1955:74)
at tryJSTransform (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/closure_state_transform.js:1989:16)
at Object.ensureES5 (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/closure_state_transform.js:2039:12)
at log.timeEvent (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/mitmproxy_interceptor.js:138:77)
at ProgressProgressBar.timeEvent (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/progress_progress_bar.js:81:20)
at interceptor (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/mitmproxy_interceptor.js:137:29)
at log.timeEvent (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/mitmproxy_interceptor.js:147:13)
at ProgressProgressBar.timeEvent (/Users/hecaiguang/Desktop/MyProjects/nodeJS/bleak/BLeak-master/dist/node/lib/progress_progress_bar.js:81:20)
http://192.168.0.83/static/js/vendor.0d7983918b9901905427.js:74178:58 Uncaught Error: only one instance of babel-polyfill is allowed
at Object. (http://192.168.0.83/static/js/vendor.0d7983918b9901905427.js:74179:59)
at Object. (http://192.168.0.83/static/js/vendor.0d7983918b9901905427.js:74185:6)
at n (http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:9:18)
at Object.678 (http://192.168.0.83/static/js/app.dce78f5dc437c6417355.js:8105:103)
at n (http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:9:18)
at window.webpackJsonp (http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:16:47)
at http://192.168.0.83/static/js/app.dce78f5dc437c6417355.js:1:1
undefined
http://192.168.0.83/static/js/vendor.0d7983918b9901905427.js:74178:58
http://192.168.0.83/static/js/vendor.0d7983918b9901905427.js:74184:5
n at http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:8:17
678 at http://192.168.0.83/static/js/app.dce78f5dc437c6417355.js:8104:102
n at http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:8:17
window.webpackJsonp at http://192.168.0.83/static/js/manifest.bba22ef4cc111880865d.js:15:46
http://192.168.0.83/static/js/app.dce78f5dc437c6417355.js:0:0
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 --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 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.
We currently add special BLeak properties to some objects. These are enumerable and visible to the instrumented program.
We should switch to using non-enumerable Symbols so the program cannot accidentally mess with our instrumentation.
This is low-priority as I have not encountered this issue in practice.
It would be awesome if I could try out BLeak via a Docker container. On my machine there are various other tools that are very picky about requiring Python 2, certain versions of node.js, etc. I can probably figure out a way to install the right dependencies for BLeak in a way that doesn't interfere, but if I could just run some kind of Docker script to have an isolated environment that would be even easier. (I'm on macOS High Sierra, in case that's relevant.)
Thanks for making BLeak available!
Something is going wrong with the editor's highlights on the Firefox devtools source code. They are not appearing on the correct line/offset. Pretty printing the code solves the issue. The pretty printer worker is also throwing an error.
Filing this bug now so I remember to circle back and fix it.
After installing leak root proxies on Loomio, the following error occurs:
http://localhost:3000/client/development/vendor.js:18808:17 Uncaught TypeError: Cannot read property 'call' of undefined
at HTMLDocument.<anonymous> (http://localhost:3000/client/development/vendor.js:18809:18)
undefined
http://localhost:3000/client/development/vendor.js:18808:17
This error does not impact BLeak's effectiveness, but does indicate that we are doing something wrong. I should look into this error seriously and see what the root cause is.
Chrome Headless often freezes up while BLeak is commanding it, and refuses to respond to debug protocol messages.
I am unsure why this is happening. I found Chrome bug reports noting some similar issues.
Hi Everyone
thanks for the great work John. this might sound silly, but we need help getting started. we've followed the steps..working on windows 10, got node, python, mitmproxy and bleak setup with a minimal config file.
however when we run bleak, all we see is a blank black screen.
in mitmproxy, we also note
1270.0.1:.....t: clientconnect
1270.0.1:.....: clientdisconnect
immediately. nothing else. Can you please help?
sorry if this seems trivial, but we really need this working.
Many thanks in advance
Gilbert
What is the right version? Got this version from the homepage at http://plasma-umass.org/BLeak/
pip install mitmproxy==4.0.1
Collecting mitmproxy==4.0.1
Could not find a version that satisfies the requirement mitmproxy==4.0.1 (from versions: 0.8, 0.8.1, 0.9, 0.9.1, 0.9.2, 0.10, 0.10.1, 0.11, 0.11.1, 0.11.2, 0.11.3, 0.12.0, 0.12.1, 0.13, 0.14.0, 0.15, 0.16, 0.17, 0.18.1, 0.18.2, 0.18.3)
No matching distribution found for mitmproxy==4.0.1
Hi,
I've managed to set up BLeak and added the mitm CA to my system. However, the wss connection to a third party system is failing with code 502. I suspect that the third party server is rejecting my certs as they have not added the mitm CA to their server. Is there a workaround for this, or would I have to get the third party to add the CA (at least in a QA environment)
Make BLeak suitable for continuous integration by letting developers specify leak roots that should be ignored as false positives during a BLeak run. Return a 0 error code if BLeak does not find any non-false positives, and return 1 if it finds memory leaks. With this change, developers can programmatically invoke BLeak and determine if it found any new memory leaks.
Enhance the heap growth graph to display heap growth with all / none of the leaks fixed, and to contain error bars like in the paper.
You won't believe it. I need help to get started.
I according to the documentation in the ubuntu 18.04 installation mitmproxy4.0.1
and python3.6
,
everything is normal, write the config. Js configuration file, running bleak run - config path/to/config. Js - out path/to/where/you/want/output
after that the console output without any information. I don't know if there's something wrong with my understanding of the tools.
The example config in the README doesn't work. I've traced back the issue to the getConfigFromSource
function.
The function works by dynamically creating a function and evaluating the config inside the function. The config needs to explicitly assign the fields on the exports
object (as the tests do).
Just writing export = {...}
(as the configuration does) does not work since that doesn't modify the exports
object when the function returns.
The test site we used (stackoverflow) was downloaded and hosted locally (/var/www/html/) on the BLeak artifact, and the following config file was run, the bleak result viewer shows "No source files found in results file"
exports.url = "http://localhost/stackoverflow/"
exports.loop = [
// First state
{
check: function() {
return true;
},
next: function() {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
}
},
{
// Return 'true' if the web application is ready for `next` to be run.
check: function() {
// Example: `group-listing` must be on the webpage
return true;
},
// Transitions to the next state.
next: function() {
// Example: Navigate to the first thread
window.scrollTo({ top: 0, behavior: 'smooth' });
}
}
];
exports.iterations = 5;
exports.postNextSleep = 5000;
bleak@bleakartifact:~/Desktop/My$ bleak run --config stackoverflow.config.js --out stackoverflow --snapshot true
http://localhost/stackoverflow/js/integrator.js:0:0 Uncaught ReferenceError: processGoogleToken is not defined
at http://localhost/stackoverflow/js/integrator.js:1:1
undefined
http://localhost/stackoverflow/js/integrator.js:0:0
http://localhost/stackoverflow/js/integrator_1.js:0:0 Uncaught ReferenceError: processGoogleToken is not defined
at http://localhost/stackoverflow/js/integrator_1.js:1:1
undefined
http://localhost/stackoverflow/js/integrator_1.js:0:0
http://localhost/stackoverflow/js/pubads_impl_2020060103.js:7910:5 Uncaught TypeError: Cannot read property 'length' of undefined
at Ot (http://localhost/stackoverflow/js/pubads_impl_2020060103.js:7911:6)
at au (http://localhost/stackoverflow/js/pubads_impl_2020060103.js:8035:40)
at http://localhost/stackoverflow/js/pubads_impl_2020060103.js:12272:3
at http://localhost/stackoverflow/js/pubads_impl_2020060103.js:12275:4
undefined
Ot at http://localhost/stackoverflow/js/pubads_impl_2020060103.js:7910:5
au at http://localhost/stackoverflow/js/pubads_impl_2020060103.js:8034:39
http://localhost/stackoverflow/js/pubads_impl_2020060103.js:12271:2
http://localhost/stackoverflow/js/pubads_impl_2020060103.js:12274:3
[====================] 100% [116/116] 85.9s (ETA 0.0s) Diagnosing leaks
Results can be found in stackoverflow
(node:2218) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: socket disconnect
Error: socket disconnect
at DebuggingProtocol.onClose (/home/bleak/Desktop/bleak/node_modules/chrome-debugging-client/dist/lib/create-debugging-protocol-client.js:47:27)
at Promise.then (/home/bleak/Desktop/bleak/node_modules/chrome-debugging-client/dist/lib/open-web-socket.js:33:22)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
[====================] 100% [116/116] 85.9s (ETA 0.0s) Diagnosing leaks(node:2218) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
at emitWarning (internal/process/promises.js:78:15)
at emitPendingUnhandledRejections (internal/process/promises.js:95:11)
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
I encountered the following error while running BLeak on above mentioned website.
BLeak config file is attached: bleak_bms.js.txt
bleak run --snapshot --config bleak_bms.js --out ./bms
DevTools listening on ws://127.0.0.1:52111/devtools/browser/e1a850ae-054d-485a-9834-6a946da45098
2018-08-25 18:16:07.622 Google Chrome[31035:851482] *** Owner supplied to -[NSTrackingArea initWithRect:options:owner:userInfo:] referenced a deallocating object. Tracking area behavior is undefined. Break on NSTrackingAreaDeallocatingOwnerError to debug.
[ ] 0% [1/276] 0.0s (ETA 0.0s) Navigating to https://in.bookmyshow.com/movies2018-08-25 18:16:08.040 Google Chrome[31035:851482] Errors logged by ksadmin: KSKeyedPersistentStore store directory does not exist. [com.google.UpdateEngine.CommonErrorDomain:501 - '/Library/Google/GoogleSoftwareUpdate/TicketStore' - 'KSKeyedPersistentStore.m:327']
KSPersistentTicketStore failed to load tickets. (productID: com.google.Chrome) [com.google.UpdateEngine.CoreErrorDomain:1051 - '/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore'] (KSKeyedPersistentStore store directory does not exist. - '/Library/Google/GoogleSoftwareUpdate/TicketStore' [com.google.UpdateEngine.CommonErrorDomain:501])
ksadmin cannot access the ticket store:<KSUpdateError:0x7f995f407a10
domain="com.google.UpdateEngine.CoreErrorDomain"
code=1051
userInfo={
function = "-[KSProductKeyedStore(ProtectedMethods) errorForStoreError:productID:message:timeoutMessage:]";
date = 2018-08-25 12:46:08 +0000;
productids = {(
"com.google.Chrome"
)};
filename = "KSProductKeyedStore.m";
line = 102;
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore";
NSUnderlyingError = <KSError:0x7f995f404c00
domain="com.google.UpdateEngine.CommonErrorDomain"
code=501
userInfo={
NSLocalizedDescription = "KSKeyedPersistentStore store directory does not exist.";
line = 327;
filename = "KSKeyedPersistentStore.m";
function = "-[KSKeyedPersistentStore(PrivateMethods) validateStorePath]";
NSFilePath = "/Library/Google/GoogleSoftwareUpdate/TicketStore";
date = 2018-08-25 12:46:08 +0000;
}
>;
NSLocalizedDescription = "KSPersistentTicketStore failed to load tickets.";
}
>
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:62:158 Uncaught ReferenceError: loadCarousel is not defined
at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:63:159
undefined
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:62:158
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233 Uncaught ReferenceError: googletag is not defined
at Object.global.initCarousels (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2075:234)
at Object.process (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:625:88)
at success (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:613:16)
at Object.success (https://in.bmscdn.com/static/js/misc-19fdffad73.js:2993:14)
at j (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:876:108)
at Object.fireWith [as resolveWith] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:919:98)
at x (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2333:575)
at XMLHttpRequest.<anonymous> (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2457:138)
undefined
global.initCarousels at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233
process at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:624:87
success at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:612:15
success at https://in.bmscdn.com/static/js/misc-19fdffad73.js:2992:13
j at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:875:107
fireWith at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:918:97
x at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2332:574
https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2456:137
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233 Uncaught ReferenceError: googletag is not defined
at Object.global.initCarousels (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2075:234)
at Object.process (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:625:88)
at success (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:613:16)
at Object.success (https://in.bmscdn.com/static/js/misc-19fdffad73.js:2993:14)
at j (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:876:108)
at Object.fireWith [as resolveWith] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:919:98)
at x (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2333:575)
at XMLHttpRequest.<anonymous> (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2457:138)
undefined
global.initCarousels at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233
process at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:624:87
success at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:612:15
success at https://in.bmscdn.com/static/js/misc-19fdffad73.js:2992:13
j at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:875:107
fireWith at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:918:97
x at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2332:574
https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2456:137
https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8 Uncaught Object
undefined
error at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8
t.Ha.onerror at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7540:14
[ ] 0% [1/276] 0.0s (ETA 0.0s) Navigating to https://in.bookmyshow.com/movies[31042:35627:0825/181614.986003:ERROR:adm_helpers.cc(73)] Failed to query stereo recording.
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:62:158 Uncaught ReferenceError: loadCarousel is not defined
at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:63:159
undefined
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:62:158
https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8 Uncaught Object
undefined
error at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8
t.Ha.onerror at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7540:14
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233 Uncaught ReferenceError: googletag is not defined
at Object.global.initCarousels (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2075:234)
at Object.process (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:625:88)
at success (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:613:16)
at Object.success (https://in.bmscdn.com/static/js/misc-19fdffad73.js:2993:14)
at j (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:876:108)
at Object.fireWith [as resolveWith] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:919:98)
at x (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2333:575)
at XMLHttpRequest.<anonymous> (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2457:138)
undefined
global.initCarousels at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233
process at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:624:87
success at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:612:15
success at https://in.bmscdn.com/static/js/misc-19fdffad73.js:2992:13
j at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:875:107
fireWith at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:918:97
x at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2332:574
https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2456:137
https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8 Uncaught Object
undefined
error at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8
t.Ha.onerror at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7540:14
https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233 Uncaught ReferenceError: googletag is not defined
at Object.global.initCarousels (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2075:234)
at Object.process (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:625:88)
at success (https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:613:16)
at Object.success (https://in.bmscdn.com/static/js/misc-19fdffad73.js:2993:14)
at j (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:876:108)
at Object.fireWith [as resolveWith] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:919:98)
at x (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2333:575)
at XMLHttpRequest.<anonymous> (https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2457:138)
undefined
global.initCarousels at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:2074:233
process at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:624:87
success at https://in.bmscdn.com/static/js/movielisting_v1-cc263e01bf.js:612:15
success at https://in.bmscdn.com/static/js/misc-19fdffad73.js:2992:13
j at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:875:107
fireWith at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:918:97
x at https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2332:574
https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:2456:137
https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8 Uncaught Object
undefined
error at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7324:8
t.Ha.onerror at https://www.googletagmanager.com/gtm.js?id=GTM-MH7KN6:7540:14
[= ] 7% [18/276] 51.2s (ETA 733.8s) Waiting 3000 ms before proceedingWeird! Found JS node with the following children: []
(node:31024) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at inlineScripts.forEach (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:105:85)
at Array.forEach (<anonymous>)
at Object.injectIntoHead (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:101:19)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:121:69)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at interceptor (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:120:21)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:147:13)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at MITMProxy.cb (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:146:13)
at MITMProxy.<anonymous> (/usr/local/lib/node_modules/bleak-detector/node_modules/mitmproxy/dist/index.js:393:33)
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at inlineScripts.forEach (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:105:85)
at Array.forEach (<anonymous>)
at Object.injectIntoHead (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:101:19)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:121:69)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at interceptor (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:120:21)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:147:13)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at MITMProxy.cb (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:146:13)
at MITMProxy.<anonymous> (/usr/local/lib/node_modules/bleak-detector/node_modules/mitmproxy/dist/index.js:393:33)
at emitWarning (internal/process/promises.js:65:17)
at emitPendingUnhandledRejections (internal/process/promises.js:109:11)
at runMicrotasksCallback (internal/process/next_tick.js:124:9)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
[= ] 7% [18/276] 51.2s (ETA 733.8s) Waiting 3000 ms before proceeding(node:31024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
TypeError: Cannot read property 'data' of undefined
at inlineScripts.forEach (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:105:85)
at Array.forEach (<anonymous>)
at Object.injectIntoHead (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/transformations.js:101:19)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:121:69)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at interceptor (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:120:21)
at log.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:147:13)
at ProgressProgressBar.timeEvent (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/progress_progress_bar.js:81:20)
at MITMProxy.cb (/usr/local/lib/node_modules/bleak-detector/dist/node/lib/mitmproxy_interceptor.js:146:13)
at MITMProxy.<anonymous> (/usr/local/lib/node_modules/bleak-detector/node_modules/mitmproxy/dist/index.js:393:33)
[= ] 7% [18/276] 51.2s (ETA 733.8s) Waiting 3000 ms before proceeding(node:31024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
at emitWarning (internal/process/promises.js:92:15)
at emitPendingUnhandledRejections (internal/process/promises.js:109:11)
at runMicrotasksCallback (internal/process/next_tick.js:124:9)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
undefined:60:50 Uncaught TypeError: Cannot read property 'click' of undefined
at Object.next (https://in.bookmyshow.com/movies:61:51)
at <anonymous>:1:21
undefined
next at https://in.bookmyshow.com/movies:60:50
[== ] 8% [22/276] 155.8s (ETA 1798.3s) Advancing to next state loop[2].next()
``` #31
One of the following error messages may occur when BLeak exits. So long as the progress bar is full (e.g., BLeak has completed all of its operations), they are safe to ignore, but are alarming for users.
Error 1:
Error in data transfer
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/protocol.py", line 496, in transfer_data
msg = yield from self.read_message()
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/protocol.py", line 526, in read_message
frame = yield from self.read_data_frame(max_size=self.max_size)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/protocol.py", line 591, in read_data_frame
frame = yield from self.read_frame(max_size)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/protocol.py", line 632, in read_frame
extensions=self.extensions,
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/framing.py", line 100, in read
data = yield from reader(2)
File "/opt/python/3.6.3/lib/python3.6/asyncio/streams.py", line 668, in readexactly
yield from self._wait_for_data('readexactly')
File "/opt/python/3.6.3/lib/python3.6/asyncio/streams.py", line 458, in _wait_for_data
yield from self._waiter
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/websockets/protocol.py", line 669, in write_frame
yield from self.writer.drain()
File "/opt/python/3.6.3/lib/python3.6/asyncio/streams.py", line 323, in drain
raise exc
File "/opt/python/3.6.3/lib/python3.6/asyncio/selector_events.py", line 762, in write
n = self._sock.send(data)
BrokenPipeError: [Errno 32] Broken pipe
Error 2:
(node:5259) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: socket disconnect
(node:5259) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
These are caused by race conditions in BLeak's shutdown code between BLeak, Chrome, and the BLeak proxy, which all run as separate processes.
I'm running into an issue were there are no stack traces available.
if I inspect the chrome console I'm seeing this error:
bleak_agent.ts:1236 Uncaught ReferenceError: ApplicationCache is not defined
at bleak_agent.ts:1236
at bleak_agent.ts:1607
My main code is behind a login, after login the app page loads twice before testing begins.
While BLeak works well on most applications / websites that I throw at it, others throw curveballs that often turn up during the diagnose step.
BLeak should serialize an early version of bleak_results.json
to disk after the leak locating / ranking stage. If it sees an incomplete bleak_results.json
in the specified output folder, it should use it to resume at the diagnose phase.
This will also greatly reduce user frustration if BLeak bugs out on their website after a long run.
While researching memory leaks / working on BLeak, I wrote a ton of command line helpers for data processing / collection, many of which are no longer useful, but remain in Git.
I should prune these down to only the few required to reproduce the information in the paper.
Running the BLeak command locally produces the below output and nothing happens after that.
MITMProxy not running; starting up mitmproxy.
Loading script /Users/nm/node_modules/mitmproxy/scripts/proxy.py
in script /Users/nm/node_modules/mitmproxy/scripts/proxy.py: No module named 'websockets'
Proxy server listening at http://*:8080
127.0.0.1:61160: clientconnect
127.0.0.1:61161: clientconnect
127.0.0.1:61161: clientdisconnect
127.0.0.1:61160: clientdisconnect
$mitmproxy --version
Mitmproxy: 4.0.4
Python: 3.7.3
OpenSSL: OpenSSL 1.0.2s 28 May 2019
Platform: Darwin-18.6.0-x86_64-i386-64bit
Hi,
after some days i managed to get Bleak running with our SPA on Ubuntu Linux.
It starts up and goes for the loop iterations but after 2 iterations it stops with the error message
TypeError: Cannot read property 'indexOrName' of null
directly after doing a heap snapshot.
Any ideas or help?
Thanks a ton,
Dirk
It looks like some unit tests are failing.
Chromium recently changed some details of its heap snapshots. I should take a look, and see if I need to adjust BLeak in some manner.
Also, I should start printing out the Chromium version to the console during unit tests, and mention what version of Chromium we've tested BLeak on.
Calculate and display a table like in the paper illustrating growth reduction for top leaks fixed.
Hello BLEAK Team,
When we are trying to install BLEAK Using GIT BASH withcommand: "npm install -g bleak-detector" we are getting below error log:
$ npm install -g bleak-detector
C:\Users\ysc1\AppData\Roaming\npm\bleak -> C:\Users\ysc1\AppData\Roaming\npm\node_modules\bleak-detector\dist\node\cli\bleak.js
[email protected] install C:\Users\ysc1\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\bufferutil
prebuild-install || node-gyp rebuild
[email protected] install C:\Users\ysc1\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\utf-8-validate
prebuild-install || node-gyp rebuild
[email protected] postinstall C:\Users\ysc1\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\mitmproxy
scripts/install_python_deps.py
'scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: scripts/install_python_deps.py
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ysc1\AppData\Roaming\npm-cache_logs\2019-01-07T14_52_05_753Z-debug.log
FYI:
We have all the valid versions of MITPROXY, PYTHON, VISUAL STUDIO and all required Softwares.
Python: 3.7.1 Version
MITPROXY: 4.0.1
Visula Studio: 2017
It would be great if you can guide us with some workaround or solution if you have found any.
I've noticed that, on occasion, BLeak reports line numbers that are off-by-one (one more than expected). BLeak transforms the web page's code during leak diagnosis, and produces a source map that it consults to map stack traces in the transformed code back to the original code, so this would seem to indicate a bug in that source map.
It is possible that this only occurs when the user is injecting fixes into the web page via the proxy, which is a hack we used in the evaluation to evaluate the impact of bug fixes on closed-source websites. In this case, the incorrect source map is expected, as the line numbers map to the code with fixes and not to the original code.
In any case, I'd like to look into this bug further, possibly with some unit tests that check the correctness of the source maps BLeak produces / stack traces it maps back to the original source.
After having followed the installation instructions and created a simple config file, trying to run
bleak run --config BLeak-config.js --out build/
results in the following error message:
in script /Users/xxxx/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/mitmproxy/scripts/proxy.py: No module named 'websockets'
Not sure what to do about this...?
Running
bleak run --config BLeak-config.js --out build/
results in
``DevTools listening on ws://127.0.0.1:59781/devtools/browser/b8feca57-07a9-440f-a0ba-daa9cccd6f2d
[= ] 2% [2/72] 2.1s (ETA 71.9s) Navigating to http://localhost/abcctv/src/[34747:17923:0612/111554.232051:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111554.277968:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111554.305943:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111604.398984:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111604.406970:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111604.474942:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111623.805647:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111625.392422:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111627.909682:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
Unable to transform /complete/search - going to proceed with untransformed JavaScript!
Error:
{ SyntaxError: unknown: Unexpected token (1:0)
1 | )]}'
| ^
2 | ["",[],[],[],{"google:clientdata":{"bpc":false,"tlw":false},"google:suggesttype":[],"google:verbatimrelevance":851}]
at Parser.pp$5.raise (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$3.parseExprAtom (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3750:12)
at Parser.pp$3.parseExprSubscripts (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3494:19)
at Parser.pp$3.parseMaybeUnary (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3474:19)
at Parser.pp$3.parseExprOps (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3404:19)
at Parser.pp$3.parseMaybeConditional (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3381:19)
at Parser.pp$3.parseMaybeAssign (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3344:19)
at Parser.pp$3.parseExpression (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:3306:19)
at Parser.pp$1.parseStatement (/Users/username/.nvm/versions/node/v10.15.3/lib/node_modules/bleak-detector/node_modules/babylon/lib/index.js:1906:19)
pos: 0,
loc: Position { line: 1, column: 0 },
_babel: true,
codeFrame:
'\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 1 | \u001b[39m)]}\u001b[32m'\u001b[39m\n \u001b[90m | \u001b[39m\u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 2 | \u001b[39m[\u001b[32m""\u001b[39m\u001b[33m,\u001b[39m[]\u001b[33m,\u001b[39m[]\u001b[33m,\u001b[39m[]\u001b[33m,\u001b[39m{\u001b[32m"google:clientdata"\u001b[39m\u001b[33m:\u001b[39m{\u001b[32m"bpc"\u001b[39m\u001b[33m:\u001b[39m\u001b[36mfalse\u001b[39m\u001b[33m,\u001b[39m\u001b[32m"tlw"\u001b[39m\u001b[33m:\u001b[39m\u001b[36mfalse\u001b[39m}\u001b[33m,\u001b[39m\u001b[32m"google:suggesttype"\u001b[39m\u001b[33m:\u001b[39m[]\u001b[33m,\u001b[39m\u001b[32m"google:verbatimrelevance"\u001b[39m\u001b[33m:\u001b[39m\u001b[35m851\u001b[39m}]\u001b[0m' }
[34747:17923:0612/111643.392441:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111646.635631:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[34747:17923:0612/111648.435471:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
Error: Operation timed out.
[= ] 4% [3/72] 122.1s (ETA 2808.7s) Waiting for login[0].check() === true[34740:30211:0612/111655.111667:ERROR:browser_process_sub_thread.cc(221)] Waited 77 ms for network service``
The url is correct and accessible in a web browser (Apache server, port 80)
The environment is Mac OS with Chrome as default system browser.
Sometimes, it's hard to figure out the right preconditions for a state, and it's easier to insert a long-enough sleep
. Selenium tests do this all of the time.
Add an option to config files so that states can have an (optional) sleep period before checking the precondition or in the place of a precondition. It's the lazy, slow, flaky option to run BLeak on your application, but I'm sure it'll save developers time.
BLeak spams a lot of debug information to the console. Instead, BLeak should clearly inform the user what it is doing:
Perhaps we could even support a progress bar of some kind.
A debug output option should still exist that spits out the information that it currently does.
Prior to publishing on NPM, make the command-line frontend into a 'bin' script so that users can just npm install -g our-package-name
and have access to bleak
from their terminal.
I ran bleak with proxy-session
in an attempt to debug why my check was timing out and I discovered that if I attempted to get my element in the proxy-session it throws this error.
For:
document.getElementById('map-1');
I get:
Error: Object reference chain is too long
at protocolError (C:\Users\cpatton\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\chrome-debugging-client\dist\lib\create-debugging-protocol-client.js:122:17)
at DebuggingProtocol.<anonymous> (C:\Users\cpatton\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\chrome-debugging-client\dist\lib\create-debugging-protocol-client.js:89:23)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\cpatton\AppData\Roaming\npm\node_modules\bleak-detector\node_modules\chrome-debugging-client\dist\lib\create-debugging-protocol-client.js:4:58)
at <anonymous>
What was interesting to me about this is I have no problem executing the getElementById
in the chrome devtools console in the window that bleak opens up.
I know this isn't necessarily an issue with the BLeak module but any thoughts?
BLeak introduces a ton of global variables. If a program clobbers any of them, including locally for some of them (e.g. $$$EQ$$$), bad things will happen.
BLeak should, instead, expose these as properties on a single global variable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.