js-libp2p-gossipsub icon indicating copy to clipboard operation
js-libp2p-gossipsub copied to clipboard

Benchmark suite does not stop after completion

Open D4nte opened this issue 3 years ago • 4 comments
trafficstars

issue updated (see history)

The benchmark suite does not stop after completion. It continues to run and just eats up more memory until no more memory is available.

▶ NODE_OPTIONS="--max-old-space-size=10480" npm run benchmark

> @chainsafe/[email protected] benchmark
> node ./node_modules/.bin/benchmark 'dist/test/benchmark/*.test.js' --local

Connected to historyProvider: LocalHistoryProvider, dirpath ./benchmark_data
No previous bencharmk found for latestCommitInBranch 'master'


  heartbeat
    ✔ heartbeat                                                           29.38305 ops/s    34.03323 ms/op        -         56 runs    202 s

<--- Last few GCs --->

[288102:0x5578850]  3658917 ms: Scavenge 9821.1 (10515.6) -> 9815.2 (10515.6) MB, 17.7 / 0.7 ms  (average mu = 0.854, current mu = 0.836) allocation failure 
[288102:0x5578850]  3658952 ms: Scavenge 9822.1 (10515.6) -> 9816.2 (10515.6) MB, 17.7 / 0.7 ms  (average mu = 0.854, current mu = 0.836) allocation failure 
[288102:0x5578850]  3658993 ms: Scavenge 9823.0 (10515.6) -> 9817.1 (10531.6) MB, 23.4 / 0.6 ms  (average mu = 0.854, current mu = 0.836) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09980 node::Abort() [node]
 2: 0xa1c235 node::FatalError(char const*, char const*) [node]
 3: 0xcf77be v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xcf7b37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xeaf3d5  [node]
 6: 0xebf09d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xec1d9e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xe832da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
 9: 0x11fc026 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
10: 0x15f0a99  [node]
[1]    288091 IOT instruction (core dumped)  NODE_OPTIONS="--max-old-space-size=10480" npm run benchmark

D4nte avatar Jul 09 '22 06:07 D4nte

cc @tuyennhv

wemeetagain avatar Jul 09 '22 16:07 wemeetagain

To unblock your PR, I'd try running only your benchmark. Either specify the file directly when calling the benchmark command or use describe.only.

wemeetagain avatar Jul 09 '22 19:07 wemeetagain

I have no issue running the benchmark

npm run benchmark

> @chainsafe/[email protected] benchmark
> node ./node_modules/.bin/benchmark 'dist/test/benchmark/*.test.js' --local

Connected to historyProvider: LocalHistoryProvider, dirpath ./benchmark_data
No previous bencharmk found for latestCommitInBranch 'master'


  heartbeat
    ✔ heartbeat                                                           23.69072 ops/s    42.21063 ms/op        -         43 runs    201 s

@D4nte you could run the index.test.js benchmark only, could you try node ./node_modules/.bin/benchmark dist/test/benchmark/index.test.js

twoeths avatar Jul 12 '22 08:07 twoeths

Thank you both for the help. I now realize that the issue is that the benchmark does not stop after execution:

▶ NODE_OPTIONS="--max-old-space-size=10480" npm run benchmark

> @chainsafe/[email protected] benchmark
> node ./node_modules/.bin/benchmark 'dist/test/benchmark/*.test.js' --local

Connected to historyProvider: LocalHistoryProvider, dirpath ./benchmark_data
No previous bencharmk found for latestCommitInBranch 'master'


  heartbeat
    ✔ heartbeat                                                           29.38305 ops/s    34.03323 ms/op        -         56 runs    202 s

<--- Last few GCs --->

[288102:0x5578850]  3658917 ms: Scavenge 9821.1 (10515.6) -> 9815.2 (10515.6) MB, 17.7 / 0.7 ms  (average mu = 0.854, current mu = 0.836) allocation failure 
[288102:0x5578850]  3658952 ms: Scavenge 9822.1 (10515.6) -> 9816.2 (10515.6) MB, 17.7 / 0.7 ms  (average mu = 0.854, current mu = 0.836) allocation failure 
[288102:0x5578850]  3658993 ms: Scavenge 9823.0 (10515.6) -> 9817.1 (10531.6) MB, 23.4 / 0.6 ms  (average mu = 0.854, current mu = 0.836) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09980 node::Abort() [node]
 2: 0xa1c235 node::FatalError(char const*, char const*) [node]
 3: 0xcf77be v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xcf7b37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xeaf3d5  [node]
 6: 0xebf09d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xec1d9e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xe832da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
 9: 0x11fc026 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
10: 0x15f0a99  [node]
[1]    288091 IOT instruction (core dumped)  NODE_OPTIONS="--max-old-space-size=10480" npm run benchmark

It continues to run after the heartbeat is done so I thought there was more to it. However, when checking the benchmark suite I can see that the heartbeat is the only benchmark suite.

I updated the issue description accordingly.

Which means this does not block my PR anymore. Thanks!

D4nte avatar Jul 13 '22 01:07 D4nte