Skip to content
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

Game crashes on playing dynamic songs with only one section [linux, macos] #161

Closed
samuelmarinsoto opened this issue Nov 22, 2024 · 11 comments · Fixed by #172
Closed

Game crashes on playing dynamic songs with only one section [linux, macos] #161

samuelmarinsoto opened this issue Nov 22, 2024 · 11 comments · Fixed by #172
Labels
bug Something isn't working

Comments

@samuelmarinsoto
Copy link

Describe the bug
Whenever the enemy brain is killed, the game will freeze for a few seconds and then crash.

To Reproduce
Steps to reproduce the behavior:

  1. Start game
  2. Go to scenarios
  3. Start Bunker Breach scenario battle (happens on anything really)
  4. Full gold, maximum AI intelligence for player and cpu
  5. Start scenario
  6. Kill enemy brain

Expected behavior
Win screen

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
here's the last error before crashing
/usr/include/c++/14/bits/stl_vector.h:1130: constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator [with _Tp = unsigned int; _Alloc = std::allocator; reference = unsigned int&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

I'm also running Nobara (Fedora based), compiled from latest develop branch (commit 34552e8)
github won't let me upload the coredump, so use this link: https://bin.dembased.xyz/corecortexcommand1000fa2728a4cbdc4f29bc28bd84d753688611174791732255150000000.zst
Ask me for it again if the link expires, or tell me how to upload it :)
Thanks!

@samuelmarinsoto samuelmarinsoto added the bug Something isn't working label Nov 22, 2024
@HeliumAnt
Copy link
Contributor

HeliumAnt commented Dec 11, 2024

Fixed in #162 ?
If you are using the flatpak release, it's already fixed! Otherwise if you're compiling yourself, apply this patch:
https://github.com/cortex-command-community/Cortex-Command-Community-Project/commit/1ef5eda87cfa714bbe13007c668298db25c52b7f.patch

Sorry missed that you're using current dev. Will need to check if that's still broken, but it does look identical to errors I was getting with error checking disabled

@michael-n0813
Copy link

Still having issues with game crashing when a brain is destroyed, with or without
luabind_args += ['-DLUABIND_NO_ERROR_CHECKING=1']

I am on Arch linux with AMD CPU and GPU.

@HeliumAnt HeliumAnt reopened this Dec 14, 2024
@HeliumAnt HeliumAnt changed the title Game crashes on game win Game crashes on playing dynamic songs with only one section Dec 14, 2024
@HeliumAnt
Copy link
Contributor

Confirmed, game reliably crashes on loss or win, or if theres otherwise only a single song to select from.
@Causeless @pawnishoovy

@HeliumAnt HeliumAnt changed the title Game crashes on playing dynamic songs with only one section Game crashes on playing dynamic songs with only one section [linux, macos] Dec 19, 2024
@pawnishoovy
Copy link
Contributor

yep, as said in discord i can't tell why this would happen. on Windows it appears to work fine. if we can't figure this out before release a dirty fix might be to insert a silent SoundContainer into single-container DynamicSongs so as to make them not single-container, which appears to be the problem if regular the battle music DynamicSong works fine.

something to test for mac/linux users:

does the single-container ambient music (appropriate activities call this when in initial edit mode i believe) also crash? does the first/some random SoundContainer from the battle music get eaten by any chance?

@michael-n0813
Copy link

michael-n0813 commented Dec 19, 2024

I don't think this has anything to do with sound containers TBH.

  • Ambient music work fine (single container)
  • setting battle music DynamicSongSelection to a single sound container works fine
  • adding more sound containers to victory/defeat still causes crashes
  • adding a braincase in a custom scenario and starting scenario causes crash (unrelated to music)

Edit 1 actually I was wrong, got it to not crash modifing Music.ini
Edit 2 Hmmm need MORE testing

@michael-n0813
Copy link

OK so

  • deleting everything from Music.ini causes game to crash on start
  • deleting everything from Music.ini except for menu music and battle music works perfect
  • adding more sound containers to single container components does not work

I think I have cracked it, having more than one dynamic song causes the game to crash.

@Causeless
Copy link
Contributor

So my suspicion, given that it works on Windows but not Linux, is that we likely have undefined behaviour somewhere. I recall some iterations of the code around the dynamic music looks a bit wonky, I guess I'll need to look again.

Of particular note GCC has some interesting (stupid) ideas about certain cases of undefined behaviour, for example in functions without a base-case return it can literally just decide to literally omit the RET instruction.

@Causeless
Copy link
Contributor

It's not undefined behaviour. It's literally just that libstdc++ is bounds-checking the vector whereas MSVC's std is not.
8993e9d probably get this to assert before crashing, but this is likely a data issue (and is likely resulting in some nasty ASAN issues even on Windows builds).

@michael-n0813
Copy link

So if I understand, it plays the DynamicSong (Battle Music for example) and upon calling a new Dynamic Song is removing (clearing) sound containers from the DynamicSong and then erroring out that the DynamicSong is empty?

@michael-n0813
Copy link

I will just say, I am a simple human and I may not know much about this error or programming but what I do know is no music = no crashes 👍

@Causeless
Copy link
Contributor

Fixed in #172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants