swarm-game / swarm

Resource gathering + programming game
Other
836 stars 52 forks source link

Scenario launch options for Tutorials crash the game #1456

Open xsebek opened 1 year ago

xsebek commented 1 year ago

Describe the bug

Trying to select options for scenario crashes the game with following message:

swarm: /dev/fd/63: openFile: invalid argument (Bad file descriptor)

To Reproduce

Expected behavior

The game should never crash. The error should mention what it was trying to open and be displayed in UI.

Additional context

This happens for most (?) tutorials, though not all - Backstory works fine and so does First Steps.

EDIT: I was not patient enough to try all, but it seems other challenges work fine. So it's only Tutorials.

xsebek commented 1 year ago

@kostmo can you reproduce this issue? It happens to me both with swarm and cabal run swarm. (GHC 9.6)

xsebek commented 1 year ago

I have checked it does not come from initialising the file browser (catch does not catch anything there) and I am out of suspects. 🤷

byorgey commented 1 year ago

I cannot reproduce this. I ran swarm using scripts/play.sh. Trying now with cabal run swarm and GHC 9.6 to see if it makes a difference. Edited: can't reproduce with GHC 9.6 either.

xsebek commented 1 year ago

Odd, I will try it in a docker container next. 😕

byorgey commented 1 year ago

@xsebek did you try this in Docker? Have you been able to reproduce it again? I am tempted to chalk it up to "gremlins" and close this. I have no idea how one could get "bad file descriptor" from a Haskell program --- maybe something to do with concurrency?

xsebek commented 1 year ago

I am tempted to chalk it up to "gremlins" and close this.

I am not able to reproduce it in a Linux container, but it happens pretty consistently on Mac with all GHC and cabal versions I tried. (GHC9.2, 9.4 and 9.6, Cabal 3.10 and 3.6 - I get linking error building vty with GHC8.10)

byorgey commented 1 year ago

it happens pretty consistently on Mac with all GHC and cabal versions I tried.

Ah, I see, let's definitely keep it open then.

byorgey commented 1 year ago

Perhaps it has something to do with reading the filesystem to populate the file picker dialog?

xsebek commented 1 year ago

Likely, though it's odd that it happens even when I leave the script option untouched.

I hope it’s an exception that we could catch and bisect the problematic code.

@kostmo if you have any suggestions where to look or how to experimentally debug this, then that would be really helpful. I get a bit lost in the options flow.

In the meantime I will try to setup a dev container for development of #1454. It will probably be handy anyway if there are more differences between the platforms.