-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Segfault in test-stringbytes-external.js #7309
Comments
FWIW, the test passes for me on Fedora 20 and OS X 10.8.5. Valgrind isn't complaining either. The compiler warning looks like a false positive; gcc doesn't realize that the call to GetExternalParts() updates |
It definitely segfaults for me on i386 / debian/unstable / g++ 4.8.2. The segfault occurs inside the [...]
// make sure Buffers from externals are the same
console.log('we reach here');
for (var i = 0; i < c_bin.length; i++) {
console.log(i, c_bin.length);
assert.equal(c_bin[i], c_ucs[i], c_bin[i] + ' == ' + c_ucs[i] +
' : index ' + i);
}
console.log('dead before here'); prints:
The final value printed is always near 380, but it varies slightly from run to run. Stack trace:
Hope that helps. |
|
Thanks, I've been able to reproduce it on ia32. x64 is unaffected for some reason. |
As with all fun bugs, I'm sure the reason will become obvious once you track down the bug. ;) I'm still only 37% of the way through the |
I suppose most of valgrind's complaints are about memory leaks? They're legitimate but harmless: node doesn't free resources on exit because there's no point, the operating system takes care of it. |
@bnoordhuis many, but not all of them. Here are the other interesting lines from the output (so far):
The tests with non-leak errors:
I'm currently at ~79% completion. valgrind is slow! |
Make calls to v8::Isolate::AdjustAmountOfExternalAllocatedMemory() take special care when negating 32 bits unsigned types like size_t. Before this commit, values were negated before they got promoted to 64 bits, meaning that on 32 bits architectures, a value like 42 got cast to 4294967254 instead of -42. That in turn made the garbage collector start scavenging like crazy because it thought the system was out of memory. That's bad enough but calls to AdjustAmountOfExternalAllocatedMemory() were made from weak callbacks, i.e. at a time when the garbage collector was already busy. It triggered asserts in debug builds and caused random crashes and memory corruption in release builds. The behavior in release builds is arguably a V8 bug and should perhaps be reported upstream. Partially fixes nodejs#7309 but requires further bug fixes to src/smalloc.cc that I'll address in a follow-up commit.
Fix a regression that was introduced in commit ce04c72 after the upgrade to V8 3.24. The new weak persistent handle API no longer gives you the original persistent but still requires that you clear it inside your weak callback. Rearrange the code in src/smalloc.cc to keep track of the persistent handle with the least amount of pain and try hard to share as much code as possible between the 'just free it' and 'invoke my callback' versions of the smalloc API. Fixes nodejs#7309.
Fix a regression that was introduced in commit ce04c72 after the upgrade to V8 3.24. The new weak persistent handle API no longer gives you the original persistent but still requires that you clear it inside your weak callback. Rearrange the code in src/smalloc.cc to keep track of the persistent handle with the least amount of pain and try hard to share as much code as possible between the 'just free it' and 'invoke my callback' versions of the smalloc API. Fixes #7309.
This test began to fail after commit ce04c72 (the previous commit 1c7bf24 did not build).
There is a compiler error which might be relevant:
The text was updated successfully, but these errors were encountered: