mojira.dev
MC-10976

Async FileSavingProcess will cause chunk overwrites/data loss ( Fix included )

2013-03-04 20:39:03 [SERVER] [INFO] Preparing start region for level 0
loading single player
2013-03-04 20:39:04 [SERVER] [INFO] Kumasasa[/127.0.0.1:0] logged in with entity id 164 at (181.97781539067591, 71.5, -108.6714197356012)
2013-03-04 20:39:58 [SERVER] [INFO] Saving and pausing game...
2013-03-04 20:39:58 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Overworld
2013-03-04 20:39:58 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Nether
2013-03-04 20:39:58 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/The End
2013-03-04 20:39:59 [SERVER] [INFO] Stopping server
2013-03-04 20:39:59 [SERVER] [INFO] Saving players
java.io.IOException: Stream Closed
        at java.io.RandomAccessFile.write(Native Method)
        at java.io.RandomAccessFile.writeInt(Unknown Source)
        at aca.a(SourceFile:307)
        at aca.a(SourceFile:249)
        at acb.close(SourceFile:230)
        at java.util.zip.DeflaterOutputStream.close(Unknown Source)
        at java.io.FilterOutputStream.close(Unknown Source)
        at acd.a(SourceFile:137)
        at acd.c(SourceFile:125)
        at akp.b(SourceFile:29)
        at akp.run(SourceFile:22)
        at java.lang.Thread.run(Unknown Source)
2013-03-04 20:39:59 [SERVER] [INFO] Saving worlds
2013-03-04 20:39:59 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Overworld
2013-03-04 20:39:59 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Nether
2013-03-04 20:39:59 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/The End
2013-03-04 20:40:00 [CLIENT] [INFO] Stopping!

Fix by @unknown in MC-103535:

Hello, this report fixes a saving-bug that has been in minecraft for years.

What is the problem? What happens?
Sometimes Chunks in the world wont be saved or overwritten by a newly generated chunk. The information of these chunks will be lost. This even happens partially without any error messages.

When does this happen?
Very rarely. This is mostly a problem of Servers with a high player count and a bigger playable area. At ~100 Players this problem occurs several times a day. With 10 players this problem might never occur.

What causes this?
The background process that saves already unloaded chunk-data to the specific regionfiles (.mca). This is happening because the service handling the currently opened regionfiles hands out references to files. This breaks synchronization-protocol.

Was this reported before?
Yes, several times without the knowledge of why, where or cause. An example would be MC-10976

Why a new report?
This report contains exact information as to why this happens and how to fix this.

Technical background information
I am using the spigot-namings. See my report here for additional information: https://hub.spigotmc.org/jira/browse/SPIGOT-2385

  • FileIOThread is the BackgroundService to save already unloaded Chunks to the specific RegionFile. This service is async

  • RegionFileCache holds a bunch of cached RegionFiles for loading/unloading data. FileIOThread regularly inserts data via this. Here is the problem, RegionFileCache hands out references to files!

  • ChunkRegionLoader uses RegionFileCache for different lookups/loading/unloading. For example it checks if a chunk already exists in a region file or not very frequently.

When does this problem occur?
Exactly when the RegionFileCache is viewed as "full" and a cleanup is triggered. The cleanup will remove all references to regionfiles from the RegionFileCache and close all regionfiles.

FileIOThread tries to saves data every X milliseconds to a regionfile.
If it already started a new try to save data - thus getting a reference to a file from ChunkRegionLoader - and directly after this the RegionFileCache cleanup is started then the data FileIOThread is saving in that moment will be lost. Additionally it is possible the data gets corrupted and minecraft will generate a fresh chunk at that location the next time it is requested.

How to reproduce?
As a developer this is very easy. Change the RegionFileCache limit from 256 to 2. This will heavily increase the frequency this problem occurs. This should be enough to spam the console with saving-errors.

Reprodution of chunk-regenerations

The best way is to change the limit to 2 as seen above

  • Create a flat world and generate enough chunks in an area

  • Create a normal world

  • Copy all the regionfiles from the flat world to the normal world (dont overwrite the level.dat)

  • Start up the server and fly around in gamemode 3.

  • The console will be full of errors. About every 1-2 minutes there will be a newly generated chunk will appear in the previously flat area.

How to fix the synchronization/reference problem?
One way to fix this to no longer give out references to files that could be unloaded at any time. Instead the service managing the references should be the only one to know about them.
This is possible with relatively low effort.

As the general implementation of RegionFileCache is faulty the method "c" and "d" need to be rewritten. They are the problem as they hand out references to region files. Instead we can change them to hand out the NBTData directly and mark them syncronized. With this setup the syncronization actually works:

Here is an example that has been tested. Only ~10 lines of code need to be changed in total.

Current implementation

// Kade possibly broken by FileIOThread! too
    @Deprecated
    public static DataInputStream c(File file, int i, int j) {
        RegionFile regionfile = a(file, i, j);

        return regionfile.a(i & 31, j & 31);
    }

    // Kade is broken by FileIOThread! This will return a reference to a file that may be removed before it is used!
    @Deprecated
    public static DataOutputStream d(File file, int i, int j) {
        RegionFile regionfile = a(file, i, j);

        return regionfile.b(i & 31, j & 31);
    }

Fixed implementation

public static synchronized NBTTagCompound fixedc(File file, int i, int j) throws IOException {
        RegionFile regionfile = a(file, i, j);
		DataInputStream datainputstream = regionfile.a(i & 31, j & 31);
		if (datainputstream == null) return null; // ChunkRegionLoader loadChunk
		return NBTCompressedStreamTools.a(datainputstream);
    }

    
    public static synchronized void fixedd(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
		RegionFile regionfile = a(file, i, j);
		DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31);
		NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); // from ChunkRegionLoader b(...)
		dataoutputstream.close();
	}

Let me know if additional information is needed.


Fixed in Spigot:

https://hub.spigotmc.org/jira/browse/SPIGOT-2385
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/7f1a32252b4fc48bad17ab3e1fc0399ce451f15e

Related issues

Comments

migrated

I have a similar issue on vanilla minecraft-1.4.7 SSP:

asdf
27 achievements
210 recipes
Setting user: xxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LWJGL Version: 2.8.5

Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.

мар 07, 2013 11:54:44 AM bdz c
INFO: Starting integrated minecraft server version 1.4.7
мар 07, 2013 11:54:44 AM bdz c
INFO: Generating keypair
мар 07, 2013 11:54:44 AM net.minecraft.server.MinecraftServer e
INFO: Preparing start region for level 0
мар 07, 2013 11:54:45 AM gm a
INFO: xxxxxxxx[/127.0.0.1:0] logged in with entity id 391 at (134.8549919735036, 71.0, 228.0527640955616)
мар 07, 2013 12:18:32 PM bdz q
INFO: Saving and pausing game...
мар 07, 2013 12:18:32 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/Overworld
мар 07, 2013 12:18:32 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/Nether
мар 07, 2013 12:18:32 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/The End
мар 07, 2013 12:18:38 PM iv a
INFO: xxxxxxxx lost connection: disconnect.quitting
мар 07, 2013 12:18:38 PM iv a
INFO: Stopping singleplayer server as player logged out
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer k
INFO: Stopping server
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer k
INFO: Saving players
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer k
INFO: Saving worlds
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/Overworld
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/Nether
мар 07, 2013 12:18:38 PM net.minecraft.server.MinecraftServer a
INFO: Saving chunks for level 'My First World'/The End
java.io.IOException: Stream Closed
	at java.io.RandomAccessFile.seek(Native Method)
	at aaj.a(SourceFile:306)
	at aaj.a(SourceFile:249)
	at aak.close(SourceFile:230)
	at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:241)
	at java.io.FilterOutputStream.close(FilterOutputStream.java:160)
	at aam.a(SourceFile:137)
	at aam.c(SourceFile:125)
	at aiw.b(SourceFile:29)
	at aiw.run(SourceFile:22)
	at java.lang.Thread.run(Thread.java:722)
Stopping!

SoundSystem shutting down...
    Author: Paul Lamb, www.paulscode.com

Notes:

------

OS: CentOS 6
Java version: java-1.7.0-openjdk-1.7.0.9-2.3.7.1.el6_3.x86_64

I had to modify installed game according to http://blog.aloneunix.ru/2012/03/minecraft-liblwjglso-wrong-elf-class.html

migrated

Just happended with Launcher 0.6:

Launcher 0.6 (Dev) (through bootstrap 2) started on windows...
System.getProperty('os.name') == 'Windows XP'
System.getProperty('os.version') == '5.1'
System.getProperty('os.arch') == 'x86'
System.getProperty('java.version') == '1.7.0_21'
System.getProperty('java.vendor') == 'Oracle Corporation'
Trying to log in...
Logged in successfully
Getting syncinfo for selected version
Queueing library & version downloads
Download job 'Version & Libraries' started (8 threads, 1 files)
Finished downloading C:\Documents and Settings\User\Application Data\.minecraft\versions\13w17a\13w17a.jar for job 'Version & Libraries': Used own copy as it matched etag
Job 'Version & Libraries' finished successfully
Delta time to compare resources: 25187 ms 
Download job 'Resources' started (8 threads, 1 files)
Finished downloading C:\Documents and Settings\User\Application Data\.minecraft\assets\READ_ME_I_AM_VERY_IMPORTANT for job 'Resources': Downloaded successfully and etag matched
Job 'Resources' finished successfully
Launching game
Launching!
Running: "C:\Program Files\Java\jre7\bin\java" -Xmx1G "-Djava.library.path=C:\Documents and Settings\User\Application Data\.minecraft\versions\13w17a\13w17a-natives" -cp "C:\Documents and Settings\User\Application Data\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.4\jopt-simple-4.4.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.0\lwjgl-2.9.0.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.0\lwjgl_util-2.9.0.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\argo\argo\2.25_fixed\argo-2.25_fixed.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\org\bouncycastle\bcprov-jdk15on\1.47\bcprov-jdk15on-1.47.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\com\google\guava\guava\14.0\guava-14.0.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Documents and Settings\User\Application Data\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Documents and Settings\User\Application Data\.minecraft\versions\13w17a\13w17a.jar" net.minecraft.client.main.Main --username Tails_D --session f1bcdee3f5a6676069122f7965d44c78b0af7355 --workDir "C:\Documents and Settings\User\Application Data\.minecraft"
---- YOU CAN CLOSE THIS LAUNCHER IF THE GAME STARTED OK ----
---- YOU CAN CLOSE THIS LAUNCHER IF THE GAME STARTED OK ----
---- YOU CAN CLOSE THIS LAUNCHER IF THE GAME STARTED OK ----
---- (We'll do this automatically later ;D) ----
Client> 249 recipes
Client> 27 achievements
Client> 2013-04-30 15:57:13 [CLIENT] [INFO] Setting user: Tails_D
Client> 2013-04-30 15:57:13 [CLIENT] [INFO] (Session ID is f1bcdee3f5a6676069122f7965d44c78b0af7355)
Client> 2013-04-30 15:57:13 [CLIENT] [INFO] LWJGL Version: 2.9.0
Client> 
Client> Starting up SoundSystem...
Client> Initializing LWJGL OpenAL
Client>     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
Client> OpenAL initialized.
Client> 
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/lava_flow.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/water_flow.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_0.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_1.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/lava.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/portal.txt
Client> 2013-04-30 15:57:19 [CLIENT] [INFO] Found animation info for: textures/blocks/water.txt
Client> 2013-04-30 15:57:20 [CLIENT] [INFO] Found animation info for: textures/items/clock.txt
Client> 2013-04-30 15:57:20 [CLIENT] [INFO] Found animation info for: textures/items/compass.txt
Client> 2013-04-30 15:57:26 [SERVER] [INFO] Starting integrated minecraft server version 13w17a
Client> 2013-04-30 15:57:26 [SERVER] [INFO] Generating keypair
Client> 2013-04-30 15:57:27 [SERVER] [INFO] Preparing start region for level 0
Client> 2013-04-30 15:57:28 [SERVER] [INFO] Preparing spawn area: 10%
Client> 2013-04-30 15:57:29 [SERVER] [INFO] Preparing spawn area: 44%
Client> 2013-04-30 15:57:30 [SERVER] [INFO] Preparing spawn area: 76%
Client> loading single player
Client> 2013-04-30 15:57:31 [SERVER] [INFO] Tails_D[/127.0.0.1:0] logged in with entity id 451 at (-190.35471836167736, 68.0, 147.52785368827918)
Client> 2013-04-30 15:57:33 [SERVER] [INFO] Saving and pausing game...
Client> 2013-04-30 15:57:33 [SERVER] [INFO] Saving chunks for level 'Test World'/Overworld
Client> 2013-04-30 15:57:34 [SERVER] [INFO] Saving chunks for level 'Test World'/Nether
Client> 2013-04-30 15:57:34 [SERVER] [INFO] Saving chunks for level 'Test World'/The End
Client> 2013-04-30 15:57:37 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
Client> 2013-04-30 15:57:51 [SERVER] [INFO] [Tails_D: Teleported Tails_D to 1000,50,70,50,0,50]
Client> 2013-04-30 15:57:51 [CLIENT] [INFO] [CHAT] Teleported Tails_D to 1000,50,70,50,0,50
Client> 2013-04-30 15:57:55 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving and pausing game...
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving chunks for level 'Test World'/Overworld
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving chunks for level 'Test World'/Nether
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving chunks for level 'Test World'/The End
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Stopping server
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving players
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving worlds
Client> 2013-04-30 15:58:06 [SERVER] [INFO] Saving chunks for level 'Test World'/Overworld
Client> 2013-04-30 15:58:07 [SERVER] [INFO] Saving chunks for level 'Test World'/Nether
Client> 2013-04-30 15:58:07 [SERVER] [INFO] Saving chunks for level 'Test World'/The End
Client> java.io.IOException: Stream Closed
Client> 	at java.io.RandomAccessFile.seek(Native Method)
Client> 	at act.a(SourceFile:306)
Client> 	at act.a(SourceFile:249)
Client> 	at acu.close(SourceFile:230)
Client> 	at java.util.zip.DeflaterOutputStream.close(Unknown Source)
Client> 	at java.io.FilterOutputStream.close(Unknown Source)
Client> 	at acw.a(SourceFile:140)
Client> 	at acw.c(SourceFile:128)
Client> 	at ali.b(SourceFile:30)
Client> 	at ali.run(SourceFile:23)
Client> 	at java.lang.Thread.run(Unknown Source)
Client> 2013-04-30 15:58:08 [CLIENT] [INFO] Stopping!
Client> 
Client> SoundSystem shutting down...
Client>     Author: Paul Lamb, www.paulscode.com
Client> 
Game ended with no troubles detected (exit code 0)
kumasasa

Can no longer observe this in newer snapshots 13w22 / 13w23. Anyone else ?

migrated

Still happens in vanilla 1.6.2

Bootstrap (v5)
Current time is Aug 2, 2013 6:50:45 PM
System.getProperty('os.name') == 'Linux'
System.getProperty('os.version') == '2.6.32-358.14.1.el6.x86_64'
System.getProperty('os.arch') == 'amd64'
System.getProperty('java.version') == '1.7.0_25'
System.getProperty('java.vendor') == 'Oracle Corporation'
System.getProperty('sun.arch.data.model') == '64'
...
Client> 2013-08-02 19:35:05 [SERVER] [INFO] Saving worlds
Client> 2013-08-02 19:35:05 [SERVER] [INFO] Saving chunks for level 'My First World'/Overworld
Client> java.io.IOException: Stream Closed
Client> at java.io.RandomAccessFile.seek(Native Method)
Client> at aea.a(SourceFile:308)
Client> at aea.a(SourceFile:251)
Client> at aeb.close(SourceFile:232)
Client> at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:241)
Client> at java.io.FilterOutputStream.close(FilterOutputStream.java:160)
Client> at aed.a(SourceFile:140)
Client> at aed.c(SourceFile:128)
Client> at amp.b(SourceFile:30)
Client> at amp.run(SourceFile:23)
Client> at java.lang.Thread.run(Thread.java:724)
Client> 2013-08-02 19:35:05 [SERVER] [INFO] Saving chunks for level 'My First World'/Nether
Client> 2013-08-02 19:35:05 [SERVER] [INFO] Saving chunks for level 'My First World'/The End
Client> 2013-08-02 19:35:07 [CLIENT] [INFO] Stopping!
Client>
Client> SoundSystem shutting down...
Client> Author: Paul Lamb, www.paulscode.com
Client>
авг 02, 2013 7:35:07 PM net.minecraft.launcher.process.ProcessMonitorThread run
SEVERE: null
java.io.IOException: Stream closed
at java.io.BufferedReader.ensureOpen(BufferedReader.java:115)
at java.io.BufferedReader.readLine(BufferedReader.java:310)
at java.io.BufferedReader.readLine(BufferedReader.java:382)
at net.minecraft.launcher.process.ProcessMonitorThread.run(ProcessMonitorThread.java:26)

Game ended with no troubles detected (exit code 0)

migrated

Still exists in 14w08a, and seems to be directly related to how much time is spent in the world.

[10:02:56 INFO]: Client> [10:02:56] [Server thread/INFO]: Saving and pausing game...
[10:02:56 INFO]: Client> [10:02:56] [Server thread/INFO]: Saving chunks for level 'New Wor'/Overworld
[10:02:56 INFO]: Client> [10:02:56] [Server thread/INFO]: Saving chunks for level 'New Wor'/Nether
[10:02:56 INFO]: Client> [10:02:56] [Server thread/INFO]: Saving chunks for level 'New Wor'/The End
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Stopping server
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Saving players
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Saving worlds
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Saving chunks for level 'New Wor'/Overworld
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Saving chunks for level 'New Wor'/Nether
[10:02:59 INFO]: Client> [10:02:59] [Server thread/INFO]: Saving chunks for level 'New Wor'/The End
[10:02:59 INFO]: Client> java.io.IOException: Stream Closed
[10:02:59 INFO]: Client> 	at java.io.RandomAccessFile.seek(Native Method)
[10:02:59 INFO]: Client> 	at asz.a(SourceFile:313)
[10:02:59 INFO]: Client> 	at asz.a(SourceFile:253)
[10:02:59 INFO]: Client> 	at ata.close(SourceFile:234)
[10:02:59 INFO]: Client> 	at java.util.zip.DeflaterOutputStream.close(Unknown Source)
[10:02:59 INFO]: Client> 	at java.io.FilterOutputStream.close(Unknown Source)
[10:02:59 INFO]: Client> 	at atc.a(SourceFile:148)
[10:02:59 INFO]: Client> 	at atc.c(SourceFile:136)
[10:02:59 INFO]: Client> 	at bcq.b(SourceFile:32)
[10:02:59 INFO]: Client> 	at bcq.run(SourceFile:25)
[10:02:59 INFO]: Client> 	at java.lang.Thread.run(Unknown Source)

I also suggest that the labels "java io exception stop server" be added. I almost posted a duplicate.

migrated

Still occuring in 14w21, according to MC-56591

Requesting to be reopened.

migrated

Confirmed for 1.8.3 according to MC-78430, but the creator of that report had anti-virus software installed.

@all, uninstall any and all anti-virus software you currently have and check to see if the issue persists.

marcono1234

You mean rather disable, uninstalling anti-virus programs is the last thing you should do

migrated

Windows 8.1 Java 1.8, v1.8.8, SSP, vanilla.

I get this often, not all the time.
Always happens while/after saving The End : Might be a clue that I've never been to The End in this world.
No, I will not disable anti-virus.

[13:15:56] [Server thread/INFO]: Stopping server
[13:15:56] [Server thread/INFO]: Saving players
[13:15:56] [Server thread/INFO]: Saving worlds
[13:15:56] [Server thread/INFO]: Saving chunks for level 'Europa'/Overworld
[13:15:56] [Server thread/INFO]: Saving chunks for level 'Europa'/Nether
[13:15:56] [Server thread/INFO]: Saving chunks for level 'Europa'/The End
java.io.IOException: Stream Closed
at java.io.RandomAccessFile.seek0(Native Method)
at java.io.RandomAccessFile.seek(Unknown Source)
at anh.a(SourceFile:315)
at anh.a(SourceFile:255)
at anh$a.close(SourceFile:236)
at java.util.zip.DeflaterOutputStream.close(Unknown Source)
at java.io.FilterOutputStream.close(Unknown Source)
at anj.b(SourceFile:140)
at anj.c(SourceFile:124)
at auc.c(SourceFile:37)
at auc.run(SourceFile:30)
at java.lang.Thread.run(Unknown Source)
[13:16:45] [Client thread/INFO]: Stopping!
[13:16:45] [Client thread/INFO]: SoundSystem shutting down...
[13:16:45] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

marcono1234

It looks like the writeChunkNBTTags(AnvilChunkLoader.PendingChunk p_75821_1_) method (which closes the file) of the net.minecraft.world.chunk.storage.AnvilChunkLoader class is called before the write(int p_76712_1_, byte[] p_76712_2_, int p_76712_3_) method (which tries to write to the file) of the net.minecraft.world.chunk.storage.RegionFile class (MCP 1.8 names).

marcono1234

Confirmed for

  • 16w02a

  • 16w04a

marcono1234

Confirmed for

  • 1.9.1-pre3

marcono1234

Confirmed for

  • 1.9.2

marcono1234

Confirmed for

  • 16w15b

md_5
marcono1234

Confirmed "Stream closed" for

  • 1.10.2

marcono1234

Confirmed "Stream closed" for

  • 16w39c

java.io.IOException: Stream Closed
	at java.io.RandomAccessFile.seek0(Native Method)
	at java.io.RandomAccessFile.seek(RandomAccessFile.java:540)
	at auw.a(SourceFile:323)
	at auw.a(SourceFile:263)
	at auw$a.close(SourceFile:244)
	at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:241)
	at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
	at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
	at auz.b(SourceFile:160)
	at auz.c(SourceFile:145)
	at bdl.c(SourceFile:37)
	at bdl.run(SourceFile:30)
	at java.lang.Thread.run(Thread.java:745)
migrated

Can confirm in 1.11.2

migrated

Saw this in 1.12.2

[File IO Thread/INFO]: [STDERR]: java.io.IOException: Stream Closed
[File IO Thread/INFO]: [STDERR]: 	at java.io.RandomAccessFile.seek0(Native Method)
[File IO Thread/INFO]: [STDERR]: 	at java.io.RandomAccessFile.seek(Unknown Source)
[File IO Thread/INFO]: [STDERR]: 	at ayj.a(SourceFile:323)
[File IO Thread/INFO]: [STDERR]: 	at ayj.a(SourceFile:263)
[File IO Thread/INFO]: [STDERR]: 	at ayj$a.close(SourceFile:244)
[File IO Thread/INFO]: [STDERR]: 	at java.util.zip.DeflaterOutputStream.close(Unknown Source)
[File IO Thread/INFO]: [STDERR]: 	at java.io.FilterOutputStream.close(Unknown Source)
[File IO Thread/INFO]: [STDERR]: 	at java.io.FilterOutputStream.close(Unknown Source)
[File IO Thread/INFO]: [STDERR]: 	at aye.b(SourceFile:160)
[File IO Thread/INFO]: [STDERR]: 	at aye.a(SourceFile:145)
[File IO Thread/INFO]: [STDERR]: 	at bgx.c(SourceFile:37)
[File IO Thread/INFO]: [STDERR]: 	at bgx.run(SourceFile:30)
[File IO Thread/INFO]: [STDERR]: 	at java.lang.Thread.run(Unknown Source)
LuxiKeks

This is also affecting every 1.13 snapshot.

kumasasa

@unknown, do you have steps to reproduce (except "Save & Quit")?
What are the circumstances?
Flatworld ? Much Redstone?
Slow disk?

Please force a crash by pressing F3 + C for 10 seconds while in-game and attach the crash report ([minecraft/crash-reports/crash-<DATE>-client.txt|http://hopper.minecraft.net/help/finding-minecraft-data-folder]) here.

migrated

I attempted several times to reproduce this in 1.13, didn't get any stream closed errors, it seems to be fixed

 

kumasasa

@unknown, the comment of @unknown above is telling the exact opposite.

migrated

I haven't checked if this happens in 1.13 snapshots, but I couldn't reproduce it in the official 1.13 release following the steps above

kumasasa

Will wait for other opinions (or even an "fixed" statement of Mojang) before resolving this as fixed.

boq

That code was reorganized somewhere before 1.14 and no longer lets files escape cache. Also, chunk IO thread is gone. So this issue is fixed.

kumasasa

(Unassigned)

Confirmed

(Unassigned)

closed, singleplayer, stream

Snapshot 13w10a, Snapshot 13w10b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, ..., Minecraft 16w50a, Minecraft 1.11.2, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w20c

Snapshot 13w16a, Snapshot 13w26a, Minecraft 1.14.3

Retrieved