[1.1.104] Null pointer dereference in rail.cpp

Place for things which are bugs but we have no idea how to solve them. Things related to hardware, libraries, strange setups, etc.
Post Reply
tuetuopay
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 28, 2024 7:32 pm
Contact:

[1.1.104] Null pointer dereference in rail.cpp

Post by tuetuopay »

Hi, I experienced a game crash on 1.1.104 build 62119.

For searchability in the forum: Rail::requestToOpenGates in rail.cpp did a null pointer dereference (Read at address 0000000000000000) on line 1745.

-> What did you do?
I am afraid I don't have much more to say as I was playing normally when it crashed. I think I clicked on the map (graphics, not button) to open it and redirect some train to some station (but did not yet).

-> What happened?
The game crashed and invited me to post it on the forum. So here I am!

-> What did you expect to happen instead?
The map top open.

-> Does it happen always, once, or sometimes?
This is the first time I've ever had the game crash.

-> If you can reproduce the issue provide the exact steps!
I will do my best to break the game again!

Attached are the logs, and the map can be found here : https://foobarbaz.s3.fr-par.scw.cloud/_autosave3.zip (autosave, I cannot tell you for how long after it it crashed). The map does not have a lot of train gates, perhaps it helps.

The game is modded with a few mods:
- Actual Craft Time v0.5.9
- Auto Deconstruct v0.3.12
- Automatic Train Painter v1.2.0
- Display Plates - Ground Signs & Map Markers v1.5.1
- Simulation Helper v1.1.6
- Spidertron Enhancements v1.9.1
- Text Plates v0.6.10
- Vil's Clear nightvision v1.0.1

Thanks!
Attachments
factorio-current.log
(6.76 KiB) Downloaded 14 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by Rseding91 »

Thanks for the report however that log file does not appear to be the correct one. It does not show any crash. Based off your description of the crash and where you say it was pointing my best guess is you have unstable and or failing hardware.

Are you experiencing any other issues with other games/software on your computer? What does running this show? https://www.memtest.org/
If you want to get ahold of me I'm almost always on Discord.

tuetuopay
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 28, 2024 7:32 pm
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by tuetuopay »

Urgh sorry for the incorrect logs. I started the game to see the game version, thus uploaded the file for the new run. Here are the correct logs attached to this message. I also noticed a crash dump file in the directory, it may help you.

As for the failing hardware, I highly doubt it. This is my main machine with rock solid uptime and overall stability (15 days currently). I'd have noticed if it started to act funny, especially to the point of causing null derefs.
Are you experiencing any other issues with other games/software on your computer?
Nope. The only one I can think of is vmware workstation not liking it when I power on and off a fourth monitor that randomly changes scaling and hdr, making its virtual gpu driver crash.
What does running this show? https://www.memtest.org/
I'll run memtest when I can, but I don't expect it to find anything.

Thanks for your time!
Attachments
factorio-dump-previous.dmp
(1.47 MiB) Downloaded 14 times
factorio-previous.log
(14.95 KiB) Downloaded 15 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by Rseding91 »

I've also seen people running their RAM overclock profiles report their computer was "completely stable" and then get random crashes in Factorio indicating it was not in fact completely stable. Disabling the overclocks fixed the issue(s) for those people.
If you want to get ahold of me I'm almost always on Discord.

tuetuopay
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 28, 2024 7:32 pm
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by tuetuopay »

I'm running them at their base EXPO profile, i.e. 3200MHz. They could go much farther as those are CL14 chips, so there's quite a high margin for tolerance.

Further, I fail to see how failing ram could lead to a null dereference. Invalid pointer definitely to some random, unallocated, memory area. But null is an oddly specific value to get memory bitflips. The only possibility would be flipping the "if not null" condition but that's likely to be in a register anyways (at most in the cache).

Anyways, I guess looking at the specified line won't hurt, as will memtest won't hurt me. I need the computer right now, but i'll run it in a few hours :)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by Rseding91 »

It can happen that the instructions the CPU is told to execute (that came from RAM) were corrupt. Additionally anything stored on the C++ stack will end up in RAM somewhere which can also get corrupt by bad RAM.

I'm not saying it's impossible there's some base game bug. But given nobody else is here reporting issues, and looking at the automatic crash logs this specific crash has 1 instance for 1.1.104 (most likely yours), and adding together the years of bug reports I've seen come through tells me it's a hardware issue on your end.

I love to be proven wrong though because it means 1 more thing I can fix in the game :)
If you want to get ahold of me I'm almost always on Discord.

tuetuopay
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Mar 28, 2024 7:32 pm
Contact:

Re: [1.1.104] Null pointer dereference in rail.cpp

Post by tuetuopay »

Hi,
So after running memtest this weekend, it indeed detected faulty RAM. As of now, I've identified one stick out of four, but it may be the CPU / Motherboard / etc that causes it (I'll test the slot with a known-good ECC stick). The other three are ongoing longer tests in dedicated machines.
Thanks!

BTW sorry for being a bit pushy, I see we both have our experiences, and I've had my fair share of issues in prod with "one in a million" races causing deref of a pointer before it was set. As you said, this is the only report on a very well coded game that people abuse to hell. I'd be curious to see what instruction flip made this check go through (my guess: jne <-> je but with the proper x86 opcodes). This is dram so we'll never know :D

I guess you can close the bug report.

Post Reply

Return to “1 / 0 magic”