Open cyberpatroll opened 2 months ago
Thanks for the detailed reproduction image.
This is indeed probably a bug caused by the rate updates.
Here's a save file of the reproduction described by @cyberpatroll, in case it can save you a couple of minutes CrashTest.zip (Simply limiting the precision of updates doesn't seem to be enough as it leaves me with negative values, but I can't say I understand your solver yet!)
I'm honestly loving this app!
But, like this bug, it crashes a lot. I've uploaded a Super Computer factory I was toying with. Lots of red lines (I don't know what they mean) and playing changing the # super computer manufactories, or dragging those red splitters to inputs, and many other things are causing crashes.
Yes it crashes a lot because the propagation algorithm is not perfect, hence the beta phase of the app.
Unfortunately, I haven't been able yet to find a better approach.
(red lines mean the rates on both sides of the link are not balanced and you need to balance them manually)
@adepierre Likewise, really enjoying the app, but I somehow got into a state with a bunch of negative inputs/outputs/multipliers, and finding it really difficult to recover because whenever I change a value the browser just completely hangs. Happens in both Firefox and Chrome
Do you have any hints or suggestions with how I can try and recover the layout back into a workable state?
@joshhunt Yes this is actually the same issue: poor handling of cycles in the graph causing an infinite update loop. Depending on the graph, it can sometimes crash, or like in this case lead to an integer overflow, causing negative values to appear.
To reduce such cases while I try to find a way to solve this, you should try to minimize the number of "cycles" in the graph.
In your case the best way to recover would be to break it in smaller parts, with as less cycles as possible by disconnecting a few splitters/mergers before updating again the left/right most value of each small part. Then once everything is balanced you can link back the splitters and mergers. If both sides of a link are already equal, it shouldn't trigger an update. Make sure you use the save button before updating a value so in case it crashes/causes a bad update you can just revert to the previous state and disconnect more links.
In planning like these, i usualy like to multiply the number of constructors, like having multiple "1.0" constructor component rather than having a single component "2.0" constructor. But in a full chain of these, changing two constructors in a row makes the site crash 100% of the time.
The best way to reproduce the bug (that i found yet), is by making a production chain to make reinforce iron plate using 120 iron ingot as a base and using cast screws. (you can see it in the attached screenshot). Then simply change the two "cast screw" constructors back to 1, and it will crash on the second.
It crashes on both firefox (with many addons) and a default chrome browser.
I think it might come from the auto load balancing feature that calculate every perfect outputs at a .001 precision for too many components. It could be cool if we were able to deactivate this, because i'm almost never gonna use 0.889 constructor.
The full error that comes in the browser console :
Script terminated by timeout at: maybeStopUnwind@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:210711 instrumentWasmExports/ret[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:210197 createExportWrapper/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:27291 invoke_viiiiii@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:243336 instrumentWasmImports/imports[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:209546 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1384]:0xdefb9 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1386]:0xebc9d @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[3075]:0x1c299c instrumentWasmExports/ret[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:210100 createExportWrapper/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:27291 _emscripten_set_main_loop_arg/browserIterationFunc/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:194804 browserIterationFunc@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:194814 callUserCallback@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106932 runIter@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:108200 Browser_mainLoop_runner@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106428 FrameRequestCallbackrequestAnimationFrame@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:115695 Browser_mainLoop_scheduler_rAF@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:102284 resume@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107691 handleSleep/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:212813 callUserCallback@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106932 safeSetTimeout/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107101 setTimeout handlersafeSetTimeout@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107047 _emscripten_sleep/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:205131 handleSleep@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:212233 _emscripten_sleep@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:205097 instrumentWasmImports/imports[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:209546 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1816]:0x145779 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1384]:0xe7d26 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1386]:0xebc9d @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[3075]:0x1c299c instrumentWasmExports/ret[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:210100 createExportWrapper/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:27291 _emscripten_set_main_loop_arg/browserIterationFunc/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:194804 browserIterationFunc@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:194814 callUserCallback@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106932 runIter@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:108200 Browser_mainLoop_runner@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106428 FrameRequestCallbackrequestAnimationFrame@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:115695 Browser_mainLoop_scheduler_rAF@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:102284 resume@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107691 handleSleep/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:212813 callUserCallback@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:106932 safeSetTimeout/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107101 setTimeout handlersafeSetTimeout@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:107047 _emscripten_sleep/<@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:205131 handleSleep@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:212233 _emscripten_sleep@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:205097 instrumentWasmImports/imports[x]@https://adepierre.github.io/ficsit-companion/ficsit-companion.js:1:209546 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1816]:0x145779 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1384]:0xe7d26 @https://adepierre.github.io/ficsit-companion/ficsit-companion.wasm:wasm-function[1386]:0xebc9d