Opened 2 months ago
Last modified 2 months ago
#6699 new defect
[macOS] Memory issue (sandboxed, spindump, ReportCrash) Spidermonkey 91
Reported by: | Langbart | Owned by: | |
---|---|---|---|
Priority: | Must Have | Milestone: | Backlog |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description (last modified by )
to consistently reproduce (1)
- add this debug message in
chatHelper.js
-
binaries/data/mods/public/simulation/ai/petra/chatHelper.js
a b PETRA.chatNewDiplomacy = function(gameState, player, newDiplomaticStance) 220 220 221 221 PETRA.chatAnswerRequestDiplomacy = function(gameState, player, requestType, response, requiredTribute) 222 222 { 223 warn(uneval(['debug', gameState, player, requestType, response, requiredTribute])) 223 224 Engine.PostCommand(PlayerID, { 224 225 "type": "aichat", 225 226 "message": "/msg " + gameState.sharedScript.playersData[player].name + " " +
- start the attached replay from ticket #6654 (~2mins long)
- the game freezes at the 97th turn
- forcefully quit the
pyrogenesis
app - check activity monitor for
spindump
- For the case described above, the process is always called
spindump
to allocate large amounts of memory, but the process can also be calledsandboxed
orReportCrash
in other situations.
- For the case described above, the process is always called
Note: To be absolutely sure, restart the PC test it again.
to consistently reproduce (2)
- pass this to the terminal and run
pyrogenesis -replay-visual="/Users/paria\ crash"
- the game crashes with the following message
- check activity monitor for
ReportCrash
- same as above with
spindump
, if I don`t stop the process manually, the PC becomes unusable with time
- same as above with
to consistently reproduce (3)
- the
sandboxed
process occurs when I try to start a replay from the built-in command line within theVSCodium
(based ofVSCode
) app.pyrogenesis -replay-visual=<here is your path to a legit replay, does not matter which one>
bisect
workaround
- Go into
Recovery mode
cmd+R
, select the Terminal- it needs to happen in
Recovery mode
because you can't edit those files below in a normal session
- it needs to happen in
- navigate to
/Volumes/{The name of your drive}/System/Library/
# disable the ReportCrash issue mv LaunchAgents/com.apple.ReportCrash.plist LaunchAgents/com.apple.ReportCrash.bak mv LaunchDaemons/com.apple.ReportCrash.Root.plist LaunchDaemons/com.apple.ReportCrash.Root.plist.bak # disable the sandboxed issue mv LaunchDaemons/com.apple.sandboxd.plist LaunchDaemons/com.apple.sandboxd.plist.bak # disable the spindumb issue mv LaunchDaemons/com.apple.spindumb.plist LaunchDaemons/com.apple.spindumb.plist.bak
related ticket
related articles
- Why are "spindump" and "sandboxd" eating up all my CPU? (27/May/21)
- ReportCrash High CPU & How to Disable reportcrash in Mac OSX (28/Sep/16)
- What is Spindump? How to read, analysis and disable Spindump (27/Sep/18)
related links
Attachments (9)
Change History (49)
by , 2 months ago
Attachment: | terminal.png added |
---|
follow-up: 2 comment:1 by , 2 months ago
comment:2 by , 2 months ago
Replying to Stan‘:
In your case it's printing the game state thousands of times that crashes the game. Is it just a way to make it faster? Can't be vulkan if it happened before. So it's Spidermonley most likely but it's probably cause we're doing something it does not like
the issue is not about the lldb
(ignore that), it about an external processing spinning up called spindump
.
follow-up: 5 comment:3 by , 2 months ago
@langbart -> Did this happen to you in regular play? Or just when adding some debugs?
comment:5 by , 2 months ago
Replying to wraitii:
@langbart -> Did this happen to you in regular play? Or just when adding some debugs?
- I have also noticed it in a regular game but have not found consistently reproducible steps.
- I described some details here: Comment 1 in Ticket 6697
comment:6 by , 2 months ago
Description: | modified (diff) |
---|
The description was extended by another possibility to reproduce the problem consistently.
by , 2 months ago
Attachment: | term_report.png added |
---|
by , 2 months ago
Attachment: | ReportCrash.png added |
---|
follow-up: 9 comment:7 by , 2 months ago
Description: | modified (diff) |
---|
- Remove bisect number
- conflicting test results, could still have been due to spidermonkey
- reproducing the steps with the released A26 version did not show any problems, so the problem must be with macOS or somewhere in the development cycle of A27
- lldb has been removed as it is not needed for the problem.
- Reproduction steps remain valid
comment:8 by , 2 months ago
Installed macOS Dependencies
❯ uname -a Darwin Paria 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64 ❯ xcode-select --version xcode-select version 2373. ❯ rustc --version rustc 1.66.1 (90743e729 2023-01-10) (built from a source tarball) ❯ cmake --version cmake version 3.25.2
comment:9 by , 2 months ago
follow-up: 11 comment:10 by , 2 months ago
Have you updated macOS recently? Both examples you mentioned produce actual crashes maybe it's a requirement. E.g you second example is just making it crash with an unsupported path
comment:11 by , 2 months ago
- terminal output: fresh install with
--force-rebuild
on library folder (latest GIT [27471]) - issue remains as described in the description
- Rename the title without including the alleged changeset, since it is no longer certain that this is the reason for the problem
Replying to Stan‘:
Have you updated macOS recently?
- always macOS 10.15.7
- only rust/cmake are updated via homebrew when new updates are released
Both examples you mentioned produce actual crashes maybe it's a requirement. E.g you second example is just making it crash with an unsupported path
The crash doesn't matter, it's just the trigger. It's about the external process eating up my memory. Crashes happened with A26 in testing as well, but never causes this external process to allocate all my memory.
comment:12 by , 2 months ago
Summary: | [macOS] Memory issue with 27412 → [macOS] Memory issue (sandboxed, spindump, ReportCrash) |
---|
comment:13 by , 2 months ago
two videos
A26 release version
- all good, no over allocation of memory after the crash
current pyrogenesis build
- the problem occurs as described in the description
follow-ups: 15 23 comment:14 by , 2 months ago
Does it do something different in release or debug modes? I know it's tedious but since it seems reproductible can you try to bisect again?
I'll see if I can try on my macos (i have monterey)
We need to figure out why macos does weird stuff with the game. When you say A26 you mean the bundle or a version you compiled yourself?
comment:15 by , 2 months ago
Replying to Stan‘:
When you say A26 you mean the bundle or a version you compiled yourself?
Yes, the official version downloaded with Homebrew.
spindump
points at [27412], ReportCrash
pointing at [27409]
I don't know how to bisect that.
the sandboxed
issue occurs when I try to start a replay from the built-in command line within the VSCodium
(based of VSCode
) app.
follow-up: 18 comment:16 by , 2 months ago
Could you try a self compiled A26? What if you run outside of vscodium?
comment:18 by , 2 months ago
Replying to Stan‘:
Could you try a self compiled A26?
is not on my wish list today, I don't think I need to. I compiled with [27408] and none of the problems listed here occur. All problems came with [27409] and above.
What if you run outside of vscodium?
then the sandboxed
issue does not occur
for the ReportCrash
process it would fill my Console
(macOS default installed application) with out of bounds abstract origin
messages and keeps going till i kill the process
by , 2 months ago
comment:20 by , 2 months ago
Yes, there is the possibility to create a sample
from the Activity Monitor
for any process
. Here are the samples that are created once I triggered the issue.
ReportCrash
issuesandboxed
issuespindump
issue
by , 2 months ago
Attachment: | spindump.txt added |
---|
by , 2 months ago
Attachment: | sandboxed.txt added |
---|
by , 2 months ago
Attachment: | ReportCrash.txt added |
---|
comment:21 by , 2 months ago
Description: | modified (diff) |
---|
comment:23 by , 2 months ago
Replying to Stan‘:
Does it do something different in release or debug modes?
- Below is the result from running
pyrogenesis_dbg
ReportCrash
issue
- the line below that starts with
Hit MOZ_CRASH()...
was revealed❯ pyrogenesis_dbg -replay-visual="/Users/paria\ crash" Path /Users/paria\ crash, separator / Function call failed: return value was -100303 (path contains both slash and backslash separators) Location: path.h:292 (DetectSeparator) Call stack: (error while dumping stack: Function not supported) errno = 0 (No error reported here) OS error = ? (C)ontinue, (S)uppress, (B)reak, Launch (D)ebugger, or (E)xit? e Redirecting call to abort() to mozalloc_abort Hit MOZ_CRASH() at /Users/paria/Developer/0ad/libraries/source/spidermonkey/mozjs-91.13.1/memory/mozalloc/mozalloc_abort.cpp:33 zsh: segmentation fault pyrogenesis_dbg -replay-visual="/Users/paria\ crash"
sandboxed
and spindump
issue
pyrogenesis_dbg
freezes or is just too slow to reproduce the problem in this mode (see #6702)
by , 2 months ago
Attachment: | mozalloc_abort.png added |
---|
follow-up: 27 comment:25 by , 2 months ago
Replying to Stan‘:
Just tested on macos, I cannot reproduce.
You have tried all three ways to trigger the problem and no process has appeared that has accumulated large amounts of memory?
Replying to Vladislav Belov:
Could you update to r27412 and revert the only vulkan folder from it?
so, but ends fatal.
# hash equivalent to [27412] git checkout bec344d807e83ce3d05ffd5713c5a53dcaea7ad2 # confirm we are on the right changset git log -1 | grep -Eo "git-svn-id: [^ ]+" # git-svn-id: https://svn.wildfiregames.com/public/ps/trunk@27412 # revert only the vulkan folder chnage git checkout HEAD~1 source/renderer/backend/vulkan/ # start building build ... fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. 3 errors generated. make[1]: *** [obj/graphics_Release/DeviceCommandContext2.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: *** [obj/graphics_Release/Buffer2.o] Error 1 10 errors generated. make[1]: *** [obj/graphics_Release/DescriptorManager.o] Error 1 make: *** [graphics] Error 2
comment:26 by , 2 months ago
Only 2) For now (I'm mostly AFK during the day). Will try 1) later today. 3) Sounds like something that is because of vscode but maybe I'm wrong.
comment:27 by , 2 months ago
Replying to Langbart:
so, but ends fatal.
It seems the added files weren't removed completely. In the source/renderer/backend/vulkan
folder should be only 3 files: Device.h
, Device.cpp
and DeviceForward.h
.
comment:28 by , 2 months ago
Description: | modified (diff) |
---|---|
Summary: | [macOS] Memory issue (sandboxed, spindump, ReportCrash) → [macOS] Memory issue (sandboxed, spindump, ReportCrash) Spidermonkey 91 |
- in short, [27412] did not cause any of the problems described here, to finally test
spindumb
you also have to restart the PC, this led me to falsely blame [27412]
- everything described here (
spinddumb
,sandboxed
and theReportCrash
issue), came with [27409]
- The only thing left to do is to try a macOS update and test again
comment:29 by , 2 months ago
Method 1
Applied
-
binaries/data/mods/public/simulation/ai/petra/chatHelper.js
220 220 221 221 PETRA.chatAnswerRequestDiplomacy = function(gameState, player, requestType, response, requiredTribute) 222 222 { 223 warn(uneval(['debug', gameState, player, requestType, response, 224 requiredTribute])) 223 225 Engine.PostCommand(PlayerID, { 224 226 "type": "aichat", 225 227 "message": "/msg " + gameState.sharedScript.playersData[player].name + " " +
Ran
$ ./pyrogenesis -replay-visual="../../../Downloads/commands.txt"
Note to self: we don't support ~ in path. The game didn't crash. I've got no spindump, sandboxd, or ReportCrash
(since it didn't crash I assume) Instead I get turn 97:
ERROR: JavaScript error: simulation/ai/petra/chatHelper.js line 223 allocation size overflow PETRA.chatAnswerRequestDiplomacy@simulation/ai/petra/chatHelper.js:223:10 PETRA.DiplomacyManager.prototype.checkEvents@simulation/ai/petra/diplomacyManager.js:217:10 PETRA.DiplomacyManager.prototype.update@simulation/ai/petra/diplomacyManager.js:524:7 PETRA.HQ.prototype.update@simulation/ai/petra/headquarters.js:2290:24 PETRA.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:118:11 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:7
Then it continues as expected considering this fatal error albeit really slowly.
Turn 97 (200)... ERROR: JavaScript error: simulation/ai/petra/chatHelper.js line 223 allocation size overflow PETRA.chatAnswerRequestDiplomacy@simulation/ai/petra/chatHelper.js:223:10 PETRA.DiplomacyManager.prototype.checkEvents@simulation/ai/petra/diplomacyManager.js:217:10 PETRA.DiplomacyManager.prototype.update@simulation/ai/petra/diplomacyManager.js:524:7 PETRA.HQ.prototype.update@simulation/ai/petra/headquarters.js:2290:24 PETRA.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:118:11 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:7 Turn 98 (200)..
Method 2
Ran
$ ./pyrogenesis -replay-visual="/Users/paria\ crash"
Got:
Path /Users/paria\ crash, separator / Function call failed: return value was -100303 (path contains both slash and backslash separators) Location: path.h:292 (DetectSeparator) Call stack: (error while dumping stack: Function not supported) errno = 0 (No error reported here) OS error = ? (C)ontinue, (S)uppress, (B)reak, Launch (D)ebugger, or (E)xit?
Pressed c
.
Got:
path.h(292): Function call failed: return value was -100303 (path contains both slash and backslash separators) ERROR: The requested replay file '/Users/paria\ crash' does not exist! stan@MacBook-Pro-de-Stanislas system %
I've got no spindump, sandboxd, or ReportCrash
Method 3
Open VSCode
$ ./pyrogenesis -replay="../../../Downloads/commands.txt"
I've got no spindump, sandboxd, or ReportCrash
processes.
I'm using macOS 12.6
comment:30 by , 2 months ago
Description: | modified (diff) |
---|
Ok, Stan. I also did not find anything on spidermonkey.dev and bugzilla.mozilla.org about those processes being mentioned in the context described here.
- will try out macOS Ventura in the coming weeks and share the results
- move the ticket to
Backlog
for now ?
- Added workaround to disable these processes manually to the description
follow-up: 32 comment:31 by , 2 months ago
I'd like you to try a bundle first if you do not mind? I will try to upload it when I get home. Thanks again for the very detailed reports means a lot to me :)
comment:32 by , 2 months ago
Description: | modified (diff) |
---|
Replying to Stan‘:
I'd like you to try a bundle first if you do not mind?
Ok
- added links to spidermonkey and bugzilla to the description
follow-up: 34 comment:33 by , 2 months ago
There you go. https://releases.wildfiregames.com/rc/0ad-0.0.27.1-alpha-aarch64.dmg
- I tried to sign it but it obviously didn't work so you'll have to xattr -cr
- I tried to bundle molten vk, but it failed too.
- Let me know if it triggers the same weird behavior.
Thanks a bunch!
comment:34 by , 2 months ago
Replying to Stan‘:
There you go.
System info
intel mac, will not allow me to
on the releases.wildfiregames.com there are two versions:
0ad-0.0.26-alpha-osx-aarch64.dmg 2022-09-24 1564.88 MB md5 sha1 minisig torrent http 0ad-0.0.26-alpha-osx64.dmg 2022-09-24 1581.57 MB md5 sha1 minisig torrent http
on the releases.wildfiregames.com/rc/ is just one
0ad-0.0.27.1-alpha-aarch64.dmg 2023-01-22 1649.85 MB md5 sha1 http
by , 2 months ago
Attachment: | mac_no_door.png added |
---|
follow-up: 37 comment:36 by , 2 months ago
Tell me if this one works https://releases.wildfiregames.com/rc/0ad-0.0.27.1-alpha-x86_64.dmg
Vulkan should work too if you enable the bundled 0ad-spirv mod :)
comment:37 by , 2 months ago
comment:39 by , 2 months ago
comment:40 by , 2 months ago
Milestone: | Alpha 27 → Backlog |
---|---|
Priority: | Release Blocker → Must Have |
I'm gonna leave it open as it seems slightly different. But at least we have a workaround now. Thank you so much for your time on this, I hope we'll find a more satisfactory fix.
In your case it's printing the game state thousands of times that crashes the game. Is it just a way to make it faster? Can't be vulkan if it happened before. So it's Spidermonley most likely but it's probably cause we're doing something it does not like