Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upCrash on loading game saved in build 3419 [$15] #12945
Comments
Coolthulhu
added
<Crash / Freeze>
(P2 - High)
labels
Jul 15, 2015
This comment has been minimized.
This comment has been minimized.
I don't think I understand what you're saying here. Do you mean 'everything works properly with freshly created worlds' or 'this bug also occurs when using freshly created worlds'? |
i2amroy
referenced this issue
Jul 15, 2015
Closed
Crash when starting new game using Play Now! option #12947
This comment has been minimized.
This comment has been minimized.
|
According to the forum, "this bug also occurs when using freshly created worlds". |
This comment has been minimized.
This comment has been minimized.
|
I mean: start 3419, generate fresh world, save, load, crash. |
This comment has been minimized.
This comment has been minimized.
|
Ouch. |
This comment has been minimized.
This comment has been minimized.
|
I can't reproduce this here on 32-bit Linux curses. Loading, saving, loading again works fine. Loading old saves works. Loading old saves, saving and reloading them works. Somebody has a backtrace? |
This comment has been minimized.
This comment has been minimized.
|
Could be something windows specific then. File access? EDIT: Building a debug build, but it'll take me an hour or more. |
This comment has been minimized.
This comment has been minimized.
|
I'll try a linux curses build when I get home from work. On 7/15/15, Coolthulhu notifications@github.com wrote:
|
This comment has been minimized.
This comment has been minimized.
|
Weird, gdb crashes on me when I try to debug the binary (at "loading symbols"). |
This comment has been minimized.
This comment has been minimized.
|
I'll poke at it when I'm home. |
This comment has been minimized.
This comment has been minimized.
|
Seems to work fine here with linux x64 tiles build at 8333882. And recent jenkins builds are at 3425... can someone on Windows confirm it works? |
This comment has been minimized.
This comment has been minimized.
|
Probably fixed by #12948? |
This comment has been minimized.
This comment has been minimized.
|
sorry, didn't manage to get to it. if some other intrepid windows haver doesn't get to it I'll confirm in eight hours or so. |
This comment has been minimized.
This comment has been minimized.
|
Still crashes for me in 3425. Windows 7, 32 bit build of the game. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Tried the same on 32bit build, and got: So I did hit spacebar and then it crashed. Also 4 million characters long line sounds fishy? EDIT: debug.log here - not that it looks useful, except maybe for the |
This comment has been minimized.
This comment has been minimized.
|
@drbig Can you upload the save (the o.0.0 file should be enough). It looks like either the JSON is not correctly written or not correctly read. |
This comment has been minimized.
This comment has been minimized.
drbig
referenced this issue
Jul 16, 2015
Closed
Tiles builds on NetBSD/amd64 7.0RC1 segfault, and even make gdb segfault #12950
This comment has been minimized.
This comment has been minimized.
|
Well, the save loads fine here on Linux. it also looks fine. The longest line has actually 4050513 characters as reported by The displayed error context is a bit of, the monster group at (384,351,0) is the second to last one. The line break is after the next monster group. The reported error location 24:4050513 is the last character on that line. My log does not contain any entries of the form GAME : GROUP__, no GROUP__ messages at all. And that is as expected (the entries appear only if a group with a radius > 1 has been split into several smaller ones, but all the groups in the save should already have radius 1). |
This comment has been minimized.
This comment has been minimized.
|
So I understand that means at least: writing saves on Windows works correctly, so the problem is with loading them. Given it works on linux could this be some bug in the Microsoft's C++ runtime? |
This comment has been minimized.
This comment has been minimized.
|
Possibly it's doing something readline-like internally and blowing up on
the super long lines. Two things to check, are we opening the file in
'binary' mode, and we can try inserting newlines among the monster groups.
|
This comment has been minimized.
This comment has been minimized.
I do remember you mentioning readline some time ago. And out of curiosity: why the monstrous lines in the first place? I agree saves are not meant to be hand-edited, but still? |
drbig
added
the
OS: Windows
label
Jul 16, 2015
This comment has been minimized.
This comment has been minimized.
|
Linux and Windows have fundamentally different approaches to things like line lengths, so (much like npm's huge chain of directories which exceed the max length for a given path on windows) Linux-appropriate things that don't work on Windows sometimes go unnoticed. |
This comment has been minimized.
This comment has been minimized.
|
@karlnp indeed. Hence the new Windows label and general appreciation of people trying to keep tabs on CDDA on Windows that know what they're doing :) |
This comment has been minimized.
This comment has been minimized.
|
I've actually been getting similar runtime errors for a few days, including when profiling, so it's entirely possible that this is related to that, but (as in the screenshots) the stack traces have been blank, so I can't say for sure. |
This comment has been minimized.
This comment has been minimized.
|
During debugging in Windows, ifstream->tellg() is spontaneously reporting incorrect values when JSON array index positions are being captured. The array index is used later when converting the string into a value. My error was that the value 400 in one array was only visible as "00", triggering a float value formatting error. I found mostly complaints about \r\n differences when searching for the reason, but this is happening near the end of the 3-4 MB line for the enemy groups. The solution that worked for me is to open files in std::ifstream::binary mode instead of the default text mode: Replace and probably any other files that are getting opened and handled by JSON in Windows. |
This comment has been minimized.
This comment has been minimized.
|
@DanmakuDan do you prefer to PR that yourself (for credit), or are you ok with someone else PRing (giving credit too would be proper also)? |
This comment has been minimized.
This comment has been minimized.
|
I'll post a small bounty, since that's going to be a pain in the ass. |
This comment has been minimized.
This comment has been minimized.
|
If |
kevingranade
changed the title
Crash on loading game saved in build 3419
Crash on loading game saved in build 3419 [$15]
Jul 16, 2015
kevingranade
added
the
Organization: Bounty
label
Jul 16, 2015
This comment has been minimized.
This comment has been minimized.
|
well I still appreciate it |
This comment has been minimized.
This comment has been minimized.
|
Indeed. @DanmakuDan you're evidently encouraged to PR fixes for it :) |
This comment has been minimized.
This comment has been minimized.
|
Btw. my question about PR was that it's a blocker so I'd rather see it fixed sooner than later. |
This comment has been minimized.
This comment has been minimized.
|
@karlnp Also please be careful on putting bounties on new issues, especially enhancements/additions - we don't want CDDA direction to be bounty-driven (we prefer it discussion-driven; bounties are to encourage effort on writing stuff that the community wants to see in). |
This comment has been minimized.
This comment has been minimized.
|
Oh, certainly. I was mainly thinking about how finicky JSON parsing is, and in how many places we do it, and how evidently Linux and Windows string handling differs and so it'll probably be more of a pain then it appears to be. |
DanmakuDan
referenced this issue
Jul 16, 2015
Merged
Changed ifstream open mode to binary for overmap and player JSON. #12962
This comment has been minimized.
This comment has been minimized.
|
Just cleaning up some manual debug stuff that I was using to track values. Also, the Windows runtime error popup is probably because the program exited with an uncaught exception throw. |
This comment has been minimized.
This comment has been minimized.
|
The funny thing is, I loaded a game from earlier into 3419 and played normally, I didn't notice the issue until I saw this thread and tried the latest version. |
This comment has been minimized.
This comment has been minimized.
|
I can confirmed that this is still FUBAR as of build 3421. EDIT: I am a derp. You guys already confirmed it's broken even into 3425. ;w; |
This comment has been minimized.
This comment has been minimized.
|
And thank you to DanmakuDan, that PR seems to have unbroke it so far. |
This comment has been minimized.
This comment has been minimized.
|
As seems to happen more often than not, the attribution for the PR didn't quite line up, so DanmakuDan is going to need to go to BountySource and manually claim it. |


Coolthulhu commentedJul 15, 2015
Seems to always reproduce: save a game in 3419 (the build that introduced new overmap saves) and load it, the game will crash during loading. Works with freshly created worlds.
Did you help close this issue? Go claim the $15 bounty on Bountysource.