justmoon / node-bignum

Big integers for Node.js using OpenSSL
420 stars 117 forks source link

*** glibc detected *** node: free(): invalid next size (fast): #84

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello. On machine "Linux ... 2.6.32-042stab113.17 #1 SMP Wed Feb 10 18:31:00 MSK 2016 i686 i686 i386 GNU/Linux" when I upgrade from 0.11.0 to ~0.12.0 I got this error:

*** glibc detected *** node: free(): invalid next size (fast): 0x09361698 ***
======= Backtrace: =========
/lib/libc.so.6(+0x70c81)[0xb72a5c81]
/lib/libc.so.6(+0x73601)[0xb72a8601]
/usr/lib/libcrypto.so.10(CRYPTO_free+0x3b)[0xb755a50b]
/home/node/projects/fraudfw/node_modules/bignum/build/Release/bignum.node(_ZN6BigNum8ToStringERKN3Nan20FunctionCallbackInfoIN2v85ValueEEE+0xbf)[0xb7076ecf]
/home/node/projects/fraudfw/node_modules/bignum/build/Release/bignum.node(+0x5471)[0xb7073471]
[0xb410df9b]
[0xb41101c7]
...
node(_ZN2v88internal9Execution4CallENS0_6HandleINS0_6ObjectEEES4_iPS4_Pbb+0x80)[0x82057c0]
node(_ZN2v88Function4CallENS_6HandleINS_6ObjectEEEiPNS1_INS_5ValueEEE+0x10c)[0x8197cac]
node(_ZN4node12MakeCallbackEN2v86HandleINS0_6ObjectEEENS1_INS0_8FunctionEEEiPNS1_INS0_5ValueEEE+0x60)[0x8459840]
node(_ZN4node12MakeCallbackEN2v86HandleINS0_6ObjectEEENS1_INS0_6StringEEEiPNS1_INS0_5ValueEEE+0xb6)[0x8459a86]
node[0x8459b05]
/usr/lib/libuv.so.0.10(+0xabe1)[0xb7755be1]
======= Memory map: ========
08048000-086dd000 r-xp 00000000 b6:43d11 137458                          /usr/bin/node
086dd000-086e1000 rw-p 00695000 b6:43d11 137458                          /usr/bin/node
086e1000-086e3000 rw-p 00000000 00:00 0
0928c000-093c8000 rw-p 00000000 00:00 0                                  [heap]

On this machine everything is ok: "Linux ... 2.6.32-042stab113.17 #1 SMP Wed Feb 10 18:31:00 MSK 2016 x86_64 x86_64 x86_64 GNU/Linux"

ghost commented 8 years ago

I can't reproduce 100% hit on error, it breaks in random points of program.

VirtuousDeath commented 4 years ago

I am experienciing a similar problem in my recent project. My Output is a bit different:

<--- Last few GCs --->

[7580:000002436BD4F640]    45361 ms: Scavenge 1165.1 (1439.3) -> 1156.9 (1443.8) MB, 24.1 / 2.9 ms  (average mu = 0.134, current mu = 0.059) allocation failure
[7580:000002436BD4F640]    47235 ms: Mark-sweep 1170.5 (1445.3) -> 1159.1 (1442.8) MB, 1763.2 / 10.7 ms  (average mu = 0.135, current mu = 0.135) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00000273779DC5C1]
    1: StubFrame [pc: 00000273779AEAC2]
    2: StubFrame [pc: 00000273779FE8A3]
Security context: 0x037ad451e6e9 <JSObject>
    3: /* anonymous */ [000003D8A8EB7FC1] [C:\www\math-app\math-package\built\types\numeric.js:1] [bytecode=0000023CC704F469 offset=10](this=0x03d8a8eb7af9 <Numeric map = 00000203E44E6439>)
    4: /* anonymous */ [000003D8A8EB7B79] [C:\www\math-app\math-package\built\types\nume...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6B48F7DDA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF6B48D2876 node::MakeCallback+4534
 3: 00007FF6B48D31F0 node_module_register+2032
 4: 00007FF6B4BEB6BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF6B4BEB5EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF6B4DD1DE4 v8::internal::Heap::MaxHeapGrowingFactor+9620
 7: 00007FF6B4DC8DC6 v8::internal::ScavengeJob::operator=+24550
 8: 00007FF6B4DC741C v8::internal::ScavengeJob::operator=+17980
 9: 00007FF6B4DD0167 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF6B4DD01E6 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF6B4EFA199 v8::internal::Factory::AllocateRawWithAllocationSite+105
12: 00007FF6B4F05133 v8::internal::Factory::NewJSGeneratorObject+147
13: 00007FF6B527BF2E v8::internal::compiler::JSIntrinsicLowering::simplified+48958
14: 00000273779DC5C1

the Numeric class is the one using the bignum. Also, some of the other libraries of bignumber like bignumber.js has this issue too. When I transpile to es6 I have the error above


it only acuses bignum package when I transpile to esNext. I am having the error below


<--- Last few GCs --->

[2328:000001A6A1B3CE90]    55562 ms: Scavenge 1393.5 (1423.2) -> 1392.4 (1423.7) MB, 5.5 / 0.8 ms  (average mu = 0.160, current mu = 0.120) allocation failure
[2328:000001A6A1B3CE90]    55582 ms: Scavenge 1393.7 (1423.7) -> 1392.8 (1424.7) MB, 6.0 / 0.7 ms  (average mu = 0.160, current mu = 0.120) allocation failure
[2328:000001A6A1B3CE90]    55602 ms: Scavenge 1394.3 (1424.7) -> 1393.3 (1429.7) MB, 6.1 / 0.9 ms  (average mu = 0.160, current mu = 0.120) allocation failure

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00000389AFB7B060]
Security context: 0x03d8ce99e6e9 <JSObject>
    1: New [000003EDC58918B1] [C:\www\math-app\math-package\built\types\numeric.js:~18] [pc=00000389AFB7B6B4](this=0x03f5ef431f09 <Numeric map = 0000013E91B65FC1>,/* anonymous */=0x01f15dd06df1 <String[1]: 1>,/* anonymous */=0x01f15dd026f1 <undefined>,/* anonymous */=0x01f15dd026f1 <undefined>,/* anonymous */=0x01f15dd026f1 <undefined>)
    2: arguments ad...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6AA497DDA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF6AA472876 node::MakeCallback+4534
 3: 00007FF6AA4731F0 node_module_register+2032
 4: 00007FF6AA78B6BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF6AA78B5EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF6AA971DE4 v8::internal::Heap::MaxHeapGrowingFactor+9620
 7: 00007FF6AA968DC6 v8::internal::ScavengeJob::operator=+24550
 8: 00007FF6AA96741C v8::internal::ScavengeJob::operator=+17980
 9: 00007FF6AA970167 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF6AA9701E6 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF6AAA9A10B v8::internal::Factory::AllocateRawWithImmortalMap+59
12: 00007FF6AAA9CA7D v8::internal::Factory::NewRawOneByteString+77
13: 00007FF6AAA9BBE9 v8::internal::Factory::NewStringFromOneByte+121
14: 00007FF6AAA9BCCA v8::internal::Factory::NewStringFromUtf8+106
15: 00007FF6AA7A6EBB v8::String::NewFromUtf8+363
16: 00007FFA4B6E2256 BigNum::New+1094 [C:\www\math-app\math-package\node_modules\bignum\bignum.cc]:L425
17: 00007FFA4B6E110C Nan::imp::FunctionCallbackWrapper+204 [C:\www\math-app\math-package\node_modules\nan\nan_callbacks_12_inl.h]:L177
18: 00007FF6AA99E1D2 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+79442
19: 00007FF6AA99F339 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+83897
20: 00007FF6AA99EA97 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+81687
21: 00007FF6AA84523A v8::internal::StackGuard::reset_limits+314
22: 00007FF6AA7A2FDD v8::Function::NewInstanceWithSideEffectType+669
23: 00007FF6AA7A2D30 v8::Function::NewInstance+32
24: 00007FFA4B6E1FB5 BigNum::New+421 [C:\www\math-app\math-package\node_modules\bignum\bignum.cc]:L388
25: 00007FFA4B6E110C Nan::imp::FunctionCallbackWrapper+204 [C:\www\math-app\math-package\node_modules\nan\nan_callbacks_12_inl.h]:L177
26: 00000389AFB7B060