Jump to content




[1.4.2][SMP/FTB][CC v1.46]Turtle looses his Mining pickaxe after Server Crash


55 replies to this topic

#41 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 13 March 2013 - 08:25 AM

That is not how it works at all. The block IS created first.

#42 OniBait

  • Members
  • 8 posts

Posted 13 March 2013 - 11:15 AM

Yeah -- looking at the code, it is creating the new block, copies the TileEntity state, removes the old block and animates.

What I can't figure out is how if the turtle block is just completely gone, why is it that we log in to find a turtle (albeit a "blank" turtle)? I suspect that there is some code in there that kinda "recovers" from the missing TileEntity, but the route it takes ends up with ComputerCraft supplying a non-upgraded turtle block and the TE not matching that block id either (just a wild guess at this point though).

Problem is looking at the code in MCPC+ (and since they comment where they change code for both bukkit and MCPC it is easy to see vanilla works similar) -- there doesn't seem to be an easy hook to try and find "orphaned" TileEntities before the chunk is loaded and they are attempted to be created in either Forge or Bukkit -- (something like a Chunk.onPreLoad would be nice).

A semi-ugly solution would be to store "Backup" type data in an NBT and check it for inconsistencies on the chunk load event -- at the very least, you'd end up with some consistent state if the server crashed. That way if the CC NBT says "you should have X turtle tile entities at these coordinates" but the chunk says "nuh uh, because the block data didn't get flushed" you could correct it. Is pretty hacky tho.

#43 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 13 March 2013 - 07:47 PM

View PostOniBait, on 13 March 2013 - 11:15 AM, said:

Yeah -- looking at the code, it is creating the new block, copies the TileEntity state, removes the old block and animates.

What I can't figure out is how if the turtle block is just completely gone, why is it that we log in to find a turtle (albeit a "blank" turtle)? I suspect that there is some code in there that kinda "recovers" from the missing TileEntity, but the route it takes ends up with ComputerCraft supplying a non-upgraded turtle block and the TE not matching that block id either (just a wild guess at this point though).

Problem is looking at the code in MCPC+ (and since they comment where they change code for both bukkit and MCPC it is easy to see vanilla works similar) -- there doesn't seem to be an easy hook to try and find "orphaned" TileEntities before the chunk is loaded and they are attempted to be created in either Forge or Bukkit -- (something like a Chunk.onPreLoad would be nice).

A semi-ugly solution would be to store "Backup" type data in an NBT and check it for inconsistencies on the chunk load event -- at the very least, you'd end up with some consistent state if the server crashed. That way if the CC NBT says "you should have X turtle tile entities at these coordinates" but the chunk says "nuh uh, because the block data didn't get flushed" you could correct it. Is pretty hacky tho.

I think a better solution is to find out why the TE gets out of sync from the block, then fix it so that an inconsistent state is never saved to disk.

#44 Barek

  • Members
  • 10 posts

Posted 21 March 2013 - 02:35 AM

Any news on this?

Is this going to be addressed in the 1.5 update?

#45 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 21 March 2013 - 02:37 AM

No. It may be addressed in the 1.5.1 update if I have time to look into it.

#46 Barek

  • Members
  • 10 posts

Posted 21 March 2013 - 03:37 AM

Thanks.

It is a bit of an inconvenience having to go to each excavating turtle after a crash (which sadly sometimes happen) and spawning it in again, getting back the programming, and restoring fuel.

#47 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 March 2013 - 03:40 AM

View PostBarek, on 21 March 2013 - 03:37 AM, said:

Thanks.

It is a bit of an inconvenience having to go to each excavating turtle after a crash (which sadly sometimes happen) and spawning it in again, getting back the programming, and restoring fuel.
Label the turtle, mine it up, put it in the crafting table with another pick. bang. done. you have your mining turtle, with all its code and its fuel level.

#48 Ville Saari

  • Members
  • 14 posts

Posted 27 March 2013 - 02:22 PM

This has happened to me twice in singleplayer without a crash. After quitting the game normally and then restarting it one of my turtles got replaced with a blank turtle with a different computer id. Peripherals, inventory, fuel, programs and label gone. Old data directory under the original computer id still existed, so I could recover my data by renaming the directory to the new id but the very expensive MiscPeripherals inventory upgrade was gone :(

This happened in overworld in FTB Mindcrack pack, but the pack has updated couple of times after the last time it happened, so I have no idea what the ComputerCraft version was.

#49 OniBait

  • Members
  • 8 posts

Posted 02 April 2013 - 04:09 AM

Thinking about this some more and looking through the code, I think that it might be due to the multi-threaded nature of CC updating blocks in the middle of a save. That is purely speculation though, perhaps I'll try and run stuff through with a debugger attached to get a better idea.

#50 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 02 April 2013 - 06:00 AM

It is purely speculation and wrong. If people continue to post incorrect theories it will be locked.

#51 Avous

  • Members
  • 31 posts

Posted 21 April 2013 - 12:28 AM

I've ran into this problem twice now All I did was let the Excavate Program run with a Chickenchunk loader (on size ten) on my server keeping them loaded whilst I slept. When I come back the Turtle stripped of equipment, label, fuel, and programs. The server has a tendency to crash once every few days so that might be it because it automatically resets if it does.

I don't know if it will help but I used this setup,

I had Turtles surrounding an Enderchest outwards with a Chunk Loader directly below the Chest and it was running excavate 64 starting with roughly 500,000 fuel each.

I had the Ender Chest linked to an automatic RP2 sorting system about 200 blocks away. The sorting system consists of a Timer, Filter, and a lot of Pneumatic Pipes going into the top of quite a bit of barrels, a lot of which with Extra-Dimensional Upgrades. I have another Chickenchunk Loader below that Ender Chest with the radius of 10 again.

All four turtles were completely reset when I found them in random positions.

Sorry I can't provide any logs or more detail. That's all I did down to a T both times.

It's odd because my most recent map reset (two weeks ago) is the first time I've ran into this bug on FTB Ultimate Pack (I manually removed Mystcraft) and it's happened twice now with barely a few days passing between them and I've played the FTB Modpack since Dec. 1st. nearly five months ago.

#52 oxgon

  • Members
  • 22 posts

Posted 22 April 2013 - 12:33 PM

Hum really weird problem, it's happening to me also. I'm on a new server with FTB ultimate and on my old server never ONCE has this happened so pretty weird.

#53 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 11 August 2013 - 07:38 AM

Does CC call World.updateTileEntityChunkAndDoNothing at all when turtles move?
If it doesn't set the TE data for the new turtle block at the same time it sets the block ID, then there would be a chance the server would save the chunk in between.

updateTileEntityChunkAndDoNothing is badly named, it marks the chunk as "modified" so it gets saved. Setting block ID or metadata already does this for you.

#54 karelmikie3

  • Members
  • 112 posts

Posted 12 August 2013 - 05:20 AM

View Poststylish, on 06 February 2013 - 02:32 PM, said:

View PostCloudy, on 06 February 2013 - 01:22 AM, said:

Crash log?

The server just freezes and requires to be force closed. Not really leaving a crash log.

aka deadlock

#55 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 12 August 2013 - 09:35 PM

View Postkarelmikie3, on 12 August 2013 - 05:20 AM, said:

View Poststylish, on 06 February 2013 - 02:32 PM, said:

View PostCloudy, on 06 February 2013 - 01:22 AM, said:

Crash log?

The server just freezes and requires to be force closed. Not really leaving a crash log.

aka deadlock

Congratulations, you replied to a post that was 6 months old. *slow claps*

#56 Barek

  • Members
  • 10 posts

Posted 12 September 2013 - 06:17 AM

View Postimmibis, on 11 August 2013 - 07:38 AM, said:

Does CC call World.updateTileEntityChunkAndDoNothing at all when turtles move?
If it doesn't set the TE data for the new turtle block at the same time it sets the block ID, then there would be a chance the server would save the chunk in between.

updateTileEntityChunkAndDoNothing is badly named, it marks the chunk as "modified" so it gets saved. Setting block ID or metadata already does this for you.

Cloudy, immibis brought the thread back up. Just making sure his post is not overlooked.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users