-
-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Squirrel can stack overflow when GCing deep structures, leading to crash #7513
Comments
When trying this with monthly autosaves , it seems to be more prevalent. |
Crash without autosaving: |
Seems AI creates too many and too big arrays (but expected with this map size and the number of towns and industries I guess). |
So we need to memory limit squirrel. I started a patch but didn't get too far, perhaps I should revisit. |
Squirrel is a bit annoying in that it doesn't allow using a stateful per-VM memory allocator. You can add some logic to the allocator functions to keep track of the total allocation size of all Squirrel VMs, but that won't help limiting each AI or GS, or detect which one is having the biggest impact. I explored letting it use a stateful allocator (e.g. arena allocator) and it will involve touching lots of Squirrel internals. |
As each VM is run serially, not concurrently, an allocator can be told which VM is currently running. It makes running VMs concurrently unfeasible but I think that is already the case. |
Using recursion for GC marking is problematic even if the total memory allocation is limited. |
See also #6322, which is not the same issue, but similar area. |
Attached is a bespoke AI that triggers this issue way sooner, usually in the first few days of it running instead of having to wait very long. |
When OpenTTD 1.11.0 stable or OpenTTD 2021-04-14 nightly crashes from running the above AI, When OpenTTD crash.log (jgrpp-0.41.0)
Note the following:
|
Version of OpenTTD
1.9.1
Expected result
crash with a dump/not crash
Actual result
OpenTTD closes itself without a dump.
Steps to reproduce
Configure one NoCAB v499 to start.
Set up opcodes to 250000 to speed things up.
Start a 4096x4096 map with high number of towns and industries.
Wait for no more than 30 minutes, for a crash/poof.
The text was updated successfully, but these errors were encountered: