MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.59k stars 430 forks source link

Computer Persistence not working #3258

Closed adriaanvanzyl closed 3 years ago

adriaanvanzyl commented 4 years ago

Versions:

Minecraft 1.12.2 Forge: 1.12.2-14.23.5.2847 OC: 1.12.2-1.7.4.153 Connected mods: Ender IO (conduits and power) Java: 1.8 (64 bit)

Here is the scenario:

I have 4 servers that run my entire power station. All 4 are loaded with an autorun script and everything works fine. That is until I reload the game.

Everytime I close the game and reenter, all my servers are turned off. Sometimes when this happens, the server harddrives get erased too.

They only way I found to keep the computers on, is to place a drone with chunckloader upgrade on top of the server rack. I haven't noticed that they turn off once I leave the chunk.

The analyzer gives no errors and the servers have enough power. I have noticed that there are some other bugs related to this issue, but it seems no one has figured this out.

Also, I'm playing single player

adriaanvanzyl commented 4 years ago

Update: Yes the computers turn themselves off when I leave the area long enough

payonel commented 4 years ago

sounds like your not running our native lua engine. check your game log for lua errors.

https://en.wikipedia.org/wiki/Minimal_working_example http://sscce.org/ https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

adriaanvanzyl commented 4 years ago

How would I use your native lua engine?

I'm positive that my code isn't the issue, because this happened before on different maps with different programs.

If I stay in the same are as the computers, the stay on forever, but the moment I close my game or move more than 200 blocks away, they just shut down. With the drone "hack", they also stay on forever

payonel commented 4 years ago

this is how to isolate a problem and report a minimal repro

  1. create a single player creative flat world with no mods but oc
  2. run /oc_sc looking at the ground a block or two in front of you, to spawn a computer
  3. start the computer
  4. exit the world (world shutdown)
  5. re-enter and test the machine is running

if the test failed (i.e. the computer is not running) then check the game logs for more details and share.

if the test passed (i.e. the computer is running) then add 1 bit of configuration closer to your gameplay experience and return to step 1

for "native engine" - that is the lua engine embedded in the jar. some hosts machines are not compatible and don't run it. the logs will mention this

adriaanvanzyl commented 4 years ago

I went through my latest log and found the following line:

[15:30:26] [Server thread/WARN] [opencomputers]: Error handling file saving: Thread pool shut down! [15:30:26] [Server thread/WARN] [opencomputers]: Creating new thread pool. [15:30:26] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 89% [15:30:27] [Server thread/INFO] [nuclearcraft]: Server Loading... [15:30:27] [Server thread/INFO] [immersiveengineering]: WorldData loading [15:30:27] [Server thread/INFO] [immersiveengineering]: WorldData retrieved [15:30:29] [Server thread/WARN] [opencomputers]: A chunk loader ticket has been orphaned! Address: eb0d2482-9455-4e42-82ab-43c031ba1f16, position: (8, 17). Removing... [15:30:29] [Server thread/WARN] [opencomputers]: A chunk loader ticket has been orphaned! Address: f67204af-de95-44af-b1e7-dc172a1bcf27, position: (8, 17). Removing...

Maybe this helps. I will try the test as soon I as I can

adriaanvanzyl commented 4 years ago

From earlier the day when the servers also stopped functioning and wiped the hard drives:

[00:35:12] [Server thread/WARN] [opencomputers]: Error handling file saving: Did the server never start? [00:35:12] [Server thread/WARN] [opencomputers]: Creating new thread pool.

payonel commented 4 years ago

pinging @Vexatos - I don't think those errors indicate the save failed

adriaanvanzyl commented 4 years ago

I want to downgrade to a version pre 1.7.3 and test it again as I see a lot of the reports regarding this very same issue, revolve around versions 1.7.3 and later

CD4017BE commented 4 years ago

I got the same issue when I was testing Open Computers blocks for compatibility with a Block Teleporter that I developed for my mod Redstone Control:

Mod setup:

Steps to recreate:

-> computer moved but turned off, no log messages. If I install OpenOS before teleport, then after teleport, the drive is wiped in a way that the file structure is still there but all files are empty. Again no log messages during or after teleport, not even debug/trace.

TileEntities are teleported by near perfectly simulating a chunk unload and reload like so:

runs during MinecraftServer.futureTaskQueue (just before world tick):
for all blocks in area {
    remove TileEntity from chunk.getTileEntityMap()
    call TileEntity.onChunkUnload()
    remove TileEntity from world.loadedTileEntityList and world.tickableTileEntities
    call TileEntity.serializeNBT()
    store nbt data for later
    swap block data in chunk storage arrays without block physics updates or anything
}
for all removed TileEntities {
    change block coordinates in nbt data
    recreate te from nbt using TileEntity.create() which calls:
    Constructor
    TileEntity.setWorldCreate()
    TileEntity.readFromNBT()

    finally add te back to world which calls:
    TileEntity.setPos()
    TileEntity.validate()
    TileEntity.onLoad()
}

the following world tick will then call TileEntity.update()
hypherionmc commented 4 years ago

Just to give an update on this ticket. I tried using opencomputers 1.7.2 on a new world. The computers stop functioning when their chuncks get unloaded. When I return to them, the indicator light on the server is off (like the server is turned off), but if I click on the server, the power button shows the server is running. I also noticed that the screens are still on, but they don't accept any input until I restart the server.

1.7.2 doesn't erase the hard drives like in my original post, but they still top functioning.

Another thing I noticed is that when using Open Computers Conduit from ENDERIO and I by accident remove a component (say a disk drive), the whole computer freezes up.

hypherionmc commented 4 years ago

I found these interesting two lines on my server log after the server stopped working: [21:05:38] [Server thread/WARN] [opencomputers]: A component of type 'screen' disappeared (d7198d98-de89-42b9-bab4-f4843c1b1d5f)! This usually means that it didn't save its node. [21:05:38] [Server thread/WARN] [opencomputers]: A component of type 'keyboard' disappeared (5b02b69a-918d-4912-bc46-8406605670d9)! This usually means that it didn't save its node.

payonel commented 3 years ago

teleporting the machines is not a supported feature, but a cross mod issue. machine persistence is complex, and not something that reproduces for me sadly (works on my box) for users that experience machine failure after a chunk load, our recommended mitigation at this time is a chunk loader

hypherionmc commented 3 years ago

Hi. I forgot this was still open. The issue turned out to be the EnderIO conduits unloading. I didn't have the same issue with the included OC cables