BitBurnerCentralManager icon indicating copy to clipboard operation
BitBurnerCentralManager copied to clipboard

FreeThreads blows out the call stack and crashes

Open wmpedersen opened this issue 2 years ago • 3 comments

Running with 24 1PB servers, may be related to #21 as the servers have a lot of threads to run but doesn't necessarily crash on boot, usually noticing this after a couple minutes, but UI interaction does slow down considerably during startup so maybe I'm just missing the crash.

--- Error Window 1 --- Maximum call stack size exceeded stack: RangeError: Maximum call stack size exceeded at Object.freeThreads (blob:file:///c22caaea-25a8-4b93-abd0-e153dc2e7ca1:151:21) at Module.main (blob:file:///c22caaea-25a8-4b93-abd0-e153dc2e7ca1:45:88)

--- Error Window 2 --- RUNTIME ERROR /Orchestrator/HackManager/manager.js@home

Cannot read properties of undefined (reading 'payload') stack: TypeError: Cannot read properties of undefined (reading 'payload') at getAvailableThreads (blob:file:///08522f7e-2c5b-46e3-8168-4be24c381006:203:28) at async pickHack (blob:file:///08522f7e-2c5b-46e3-8168-4be24c381006:164:38) at async Module.main (blob:file:///08522f7e-2c5b-46e3-8168-4be24c381006:59:13)

wmpedersen avatar Mar 01 '22 22:03 wmpedersen

Have you tried tweaking the script start time in the option?

The scripts have a lot of concurrent check every X ms, it may be too memory intensive with extremely large amount of threads...

HtheChemist avatar Mar 02 '22 02:03 HtheChemist

In the im-game options (script exec time)? I just tried with the max 100ms instead of default 20, but it's also failing.

wmpedersen avatar Mar 02 '22 12:03 wmpedersen

Hmm maybe trying to increase the delay of the different message check?

The default ns.sleep is 100 ms, this is probably too low. There is no central config value for this though, but it could be moved into one so it can be optimized. Most of these should be found in MessageManager/class.ts

I don't play anymore, so I can't test it on my side. If you do a PR I'll accept it.

HtheChemist avatar Mar 02 '22 15:03 HtheChemist