Podshot / MCEdit-Unified

Combined MCEdit & Pymclevel repository.
http://podshot.github.io/MCEdit-Unified/
ISC License
483 stars 109 forks source link

Occasional "Error reading chunk" message when saving #877

Open allamassal opened 6 years ago

allamassal commented 6 years ago

Sometimes, when I save my edits, a warning message saying "Error reading chunk:" appears. You might be thinking that there is something after the colon, but there is none. When this happens, it is always during the lighting phase, not the actual saving.

LaChal commented 6 years ago

Put the log file (in MCEdit folder) somewhere like pastebin so we can check. Also, the console out put can be useful, so paste it here.

allamassal commented 6 years ago

What I described is actually only in the console. It just says [WARNING][ root.py.864]Error reading chunk: in the console and then nothing after that.

StealthyExpertX commented 6 years ago

Was the world opened in Minecraft while you were editing and saving it in mcedit?

allamassal commented 6 years ago

No it was not.

Podshot commented 6 years ago

Could you still give us the output of the console window? It could help us figure out what is going on. What was the last version of Minecraft did you open the world in?

allamassal commented 6 years ago

The last version of Minecraft I opened the world in was 1.12.2 (in fact the only version that I have ever opened the world on). Please note that this is not limited to this specific world, and has happened to me many times throughout my time using MCEdit. I can't seem to paste directly from the console window.

Podshot commented 6 years ago

If you can take a screenshot of the console windows with the full error, that would work just as well

allamassal commented 6 years ago

Here is a screenshot of the console window: mceditsavingerror

alphapapa commented 6 years ago

Also having this problem.

Minecraft 1.12.2 MCEdit https://github.com/Khroki/MCEdit-Unified/commit/2a29075d1a361622209be79256cc570d9f0c0b4e (latest as of this writing) Ubuntu Trusty 14.04

  1. Opened World A.
  2. Selected and exported chunks.
  3. Opened World B.
  4. Imported schematic.
  5. Began Save process.

After the lighting pass completed, the saving chunks pass started, and a few seconds after that, when it was about 5-10% complete, the save dialog disappeared.

This is the console output immediately preceding the failure:

Destination:  _Vector(x=640, y=0, z=-272)
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk: 
[ WARNING][                   root.py:816]:Error reading chunk:

However, there is more buggy behavior to this story, and I don't know if it's related:

I have been trying for a few hours to import part of one world into another. I tried both exporting a schematic of the source world and importing the source world's level.dat file directly. In both cases, a significant number of chunks were simply missing after import. I ran the export process several times, and each time the chunks that were missing were in different places (of course, I could not select exactly the same boundaries each time). (To clarify, the missing chunks changed when I exported the area again. Each time I imported the same area, the missing chunks were in the same places.) Strangely, the missing chunks seemed to be concentrated on the leftmost 1/4th of the imported areas, but there were missing chunks all over the areas. I tried exporting/importing smaller and smaller areas, but there were chunks missing each time.

Finally I tried to copy/paste the area instead of exporting/importing. However, when I clicked the Import button to import the pasted area, I got an error:

[ WARNING][                   root.py:816]:Error reading chunk: [Errno 2] No such file or directory: '/tmp/tmp7Hf1PCschematic/##MCEDIT.TEMP##/region/r.1.1.mca'
[   ERROR][                    root.py:59]:Exception:
Traceback (most recent call last):
  File "/home/me/tmp/src/MCEdit-Unified/mceutils.py", line 53, in _alertException
    return func(*args, **kw)
  File "/home/me/tmp/src/MCEdit-Unified/editortools/clone.py", line 1041, in confirm
    self.editor.addOperation(op)
  File "/home/me/tmp/src/MCEdit-Unified/leveleditor.py", line 3035, in addOperation
    self.performWithRetry(op)
  File "/home/me/tmp/src/MCEdit-Unified/leveleditor.py", line 3046, in performWithRetry
    op.perform(self.recordUndo)
  File "/home/me/tmp/src/MCEdit-Unified/editortools/clone.py", line 217, in perform
    [i.perform(False) for i in self.blockCopyOps]
  File "/home/me/tmp/src/MCEdit-Unified/editortools/clone.py", line 142, in perform
    showProgress(_("Copying {0:n} blocks...").format(self.sourceBox.volume), i)
  File "/home/me/tmp/src/MCEdit-Unified/albow/extended_widgets.py", line 359, in showProgress
    if widget.present():
  File "/home/me/tmp/src/MCEdit-Unified/albow/widget.py", line 525, in present
    self.root.run_modal(self)
  File "/home/me/tmp/src/MCEdit-Unified/albow/root.py", line 233, in run_modal
    self.gl_draw_all(self, (0, 0))
  File "/home/me/tmp/src/MCEdit-Unified/albow/widget.py", line 766, in gl_draw_all
    subwidget.gl_draw_all(root, suboffset)
  File "/home/me/tmp/src/MCEdit-Unified/albow/widget.py", line 773, in gl_draw_all
    self.draw_all(surface)
  File "/home/me/tmp/src/MCEdit-Unified/albow/widget.py", line 334, in draw_all
    self.draw(surface)
  File "/home/me/tmp/src/MCEdit-Unified/albow/extended_widgets.py", line 275, in draw
    amount = progressIterator.next()
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/block_copy.py", line 104, in copyBlocksFromIter
    sourceChunk = sourceLevel.getChunk(*srcCpos)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/infiniteworld.py", line 1720, in getChunk
    chunkData = self._getChunkData(cx, cz)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/infiniteworld.py", line 1684, in _getChunkData
    self._storeLoadedChunkData(chunkData)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/infiniteworld.py", line 1698, in _storeLoadedChunkData
    self.unsavedWorkFolder.saveChunk(ocx, ocz, data)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/infiniteworld.py", line 1070, in saveChunk
    regionFile.saveChunk(cx, cz, data)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/regionfile.py", line 226, in saveChunk
    self._saveChunk(cx, cz, data, self.VERSION_DEFLATE)
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/regionfile.py", line 286, in _saveChunk
    with self.file as f:
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/regionfile.py", line 35, in file
    return openfile()
  File "/home/me/tmp/src/MCEdit-Unified/pymclevel/regionfile.py", line 29, in <lambda>
    openfile = lambda: open(self.path, "rb+")
IOError: [Errno 2] No such file or directory: '/tmp/tmp7Hf1PCschematic/##MCEDIT.TEMP##/region/r.1.1.mca'

I looked at that directory and saw that the missing files were actually in /tmp/tmp7Hf1PCschematic/region/, so I pasted the area again, then symlinked the region directory into the ##MCEDIT.TEMP## directory while MCEdit was running, and then clicked the Import button.

This time the paste-import completed, and there were no missing chunks!

So I tried to save the world, and after completing the lighting phase, that's when it gave the Error reading chunk errors, shortly after starting the chunk-saving phase.

So, to summarize:

  1. The Error reading chunk error happens when saving the level, after the lighting phase.
  2. The copy/paste operation seems to fail because the temporary region files are not in the correct location (a separate bug, maybe).
  3. The export operation exports areas with randomly missing chunks, seemingly concentrated on the left/west side of the selected area (also a separate bug, maybe).

Please let me know if I can help debug this further. I haven't messed with PyGame or anything that complicated before, but I have done a little Python.

Thanks for your work on MCEdit.

Update: I clicked the Save button again, and the saving chunks dialog appeared briefly and disappeared. There was no further console output. So I clicked the Reload button to reload the world, and the pasted-imported chunks appear to be intact. I haven't loaded the world in Minecraft yet, and I haven't looked carefully at the rest of the world in MCEdit. But, if I'm lucky, the Error reading chunk error will not actually corrupt the world... I'll post more information later if I have any. Thanks.

allamassal commented 6 years ago

The only difference is that for me, there is nothing after the colon in the "Error reading chunk" messages, and there is rarely more than one message at a time. And, it doesn't happen every time.

alphapapa commented 6 years ago

Update: All of the imported regions I added worked correctly except for one, which had some narrow gaps from 256 down to 0 around some of its edges. I don't know if it that's related to this issue.

allamassal commented 6 years ago

I became convinced that my changes actually weren't getting saved because of this issue, but when I hit Reload after getting 2 of those messages within one minute my changes were still there. What does that tell you?