GregTech icon indicating copy to clipboard operation
GregTech copied to clipboard

Game crash on connecting LV machine to MV energy cable

Open LAGIdiot opened this issue 4 years ago • 7 comments

Version: 1.9.1 (dev build on 853ffbc44a239df957fbe4a434f2733810253e41)

Environment: GTCE dev; new world generated

Setup: 2020-03-25_20 16 32 HV Diesel generator with fuel in HV Transformer (transform down) Cable (any MV and higher) MV Machine (probably any, tested on Electrolyzer, Fermenter)

Steps to reproduce: Place LV machine (probably any, tested on Electric Furnace, Autoclave, Bending Machine) on Cable

Expected:

  • LV machine blow up

Actual:

LAGIdiot avatar Mar 25 '20 19:03 LAGIdiot

@LAGIdiot I can't reproduce this on the master branch just fyi. image

  • That's a HV Diesel Gen with Nitro diesel
  • Connected to a HV transformer in (default) down-transform mode, inputing from left, outputing to right (into the cable)
  • Attached to 8x MV cable (tried 4x as well)
  • The crater is where I keep attaching LV machines (autoclave, etc). No crash occurs.

pyure avatar Apr 12 '20 23:04 pyure

I think that MV machine on end of my setup is crucial as it works as consumer.

LAGIdiot avatar Apr 13 '20 06:04 LAGIdiot

I just tried to reproduce this, and yes, the MV machine is needed to reproduce the crash.

ALongStringOfNumbers avatar Nov 12 '20 17:11 ALongStringOfNumbers

Thanks for reproducing this issue. Can you please mention version on which you were able to do it and if possible steps if they are more clearer than these provided by me.

LAGIdiot avatar Nov 18 '20 10:11 LAGIdiot

I was able to reproduce this in a development environment (That is up to date against the 1.10.5.582 commits) by following the exact instructions provided in the initial issue. This is the crash log retrieved from that crash: Crash

However, when I tried to reproduce this in a non-development environment, with a minimal modlist, I was not able to produce this crash. The modlist for the minimal environment is here: modlist

ALongStringOfNumbers avatar Nov 18 '20 15:11 ALongStringOfNumbers

Well this is quite strange as it does probably happen only on dev environment but I will accept it anyway.

LAGIdiot avatar Nov 18 '20 16:11 LAGIdiot

After doing a lot of testing in-game and in the code, I discovered that the crash is caused because the call to energyNet.getAllNodes().get(destinationPos) returns a null, so when .blockedConnections is called on it, it throws a NPE, causing a crash. I'm not certain why this is, but I have a few more specificities regarding when the crash occurs as well.

First of all, the crash only occurs when the lower-voltage machine is placed on a cable that has no other connections. This includes the Transformer and the Electrolyzer, in this case. I also still could not reproduce this issue outside of a dev environment.

It only seems to appear when a Transformer is present. I tested this out using a Transformer stepping down from EV -> HV, and it caused the same crash when an MV machine was placed on the line. I also tested out if the issue had to do with simply more than one amp, but that did not result in a crash. It also did not crash when placing an LV machine on a normal MV line with no Transformer.

I also wanted to point out that we cannot simply check for if the node at destinationPos is null and skip, since this would potentially introduce amperage problems in the energyNet, as this blockedConnections call is important to the calculation of the total amperage of the energyNet. Hopefully this helps, sorry that I couldn't yet determine a fix, or figure out more in-depth why a Transformer specifically causes this.

serenibyss avatar Jan 22 '21 09:01 serenibyss