-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ses): finite deep stacks, on by default #1513
Conversation
@kriskowal if you could have a look at this, that'd be great. CI is giving me a jackpot of errors, all of which seem rooted in
where the immediately relevant code in bundle.js is const { code: terse } = terser.minify(bundle, {
mangle: false,
keep_classnames: true,
});
console.log(`Bundle size: ${bundle.length} bytes`);
console.log(`Minified bundle size: ${terse.length} bytes`); However, this PR itself is clearly completely independent of bundling. I don't see how it could be affected. Any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unbounded leak that caused us to turn deep stacks off was really the unbounded memory of error-note-graphs.
Huh, really? I would have expected takeNoteLogArgsArray
to free that... was nothing calling it?
a401b0d
to
6f0c5c8
Compare
Only for errors that are actually reported. The fatal leak were for errors that could eventually be potentially reported, but were not. |
PTAL |
6f0c5c8
to
633ad2a
Compare
I also changed the default budget from We should also consider configuring the budget with an environment option. |
d5fd4c2
to
a678a6d
Compare
Worked around stale tooling. Bug at #1514 . (@kriskowal , thanks!) |
4d40dcc
to
f9fa1a4
Compare
I reduced the note-args budget again, this time to // Bizarrely, if set to 1000 or 10_000, captp/test/test-gc.js
// test 'test loopback gc' fails ONLY ON WINDOWS.
// TODO: Figure out why, and either special case or fix.
// TODO: Once captp/test/test-gc.js doesn't stop us,
// set this default back to a more reasonable number.
// TODO: make this default configurable by an environment option.
const defaultLogArgsBudget = 100; |
Given the nature of this PR, before merging, it is worth checking the effect on performance. The following first crude test is consistent enough to show we're ok, or even a bit better! #1515 , identical to current master, has the following timings from CI Compare with the timings of this PR under CI. Bizarrely, this PR is always the same or faster. (ignoring the failed test) |
At |
f9fa1a4
to
7914408
Compare
00db78c
to
90dc3e9
Compare
90dc3e9
to
dd4d68a
Compare
7914408
to
98b3731
Compare
35b7cce
to
ae6cd87
Compare
ae6cd87
to
153eb89
Compare
Re #1513 (comment) , #1516 fixed the immediate problem, the OS-dependent behavior. However, this PR still changes the counts, for reasons we (@michaelfig and I) do not yet precisely understand but believe are fine for now. @michaelfig, I changed those lines as we discussed but also added a TODO // TODO(mfig,erights): explain why #1513 changed these counts from 3 to 2
t.is(getFarStats().sendCount.CTP_DROP, 2);
t.is(getNearStats().recvCount.CTP_DROP, 2); |
The deep stacks continue to use the
assert.note
mechanism to associate an error with previous stack-capturing errors. The unbounded leak that caused us to turn deep stacks off was really the unbounded memory of error-note-graphs.Prior to this PR, the line disabling deep stacks by default was commented
This PR makes the error-note storage into a finite budget LRU cache, defaulting to a budget of
1000
. With the memory leak fixed,track-turns.js
is changed to enable deep stacks by default. Measurements will still be needed to see what the cost is, and what is a reasonable budget.