mojira.dev
MC-526

Worlds will not delete

The bug

When trying to delete a world, the world would still show up in the single player world selection screen. I was expecting the world to delete, but instead it just stayed in the world selection screen. To trigger this, create a world, (I just did creative, I don't know about survival) and attempt to delete it.

Code analysis / reason

See the following comments

Solution ideas

See the following comments

Related issues

MC-1041 You can't delete worlds in Minecraft 1.4.2! MC-2406 Not being able to delete world properly after defeating The Ender Dragon MC-33400 Unable to Delete Worlds Named "Dinnerbone" MC-47384 Flatland Bug MC-54540 14w18b customized world terrain errors MC-55804 Extreme Hills (Corruption?) Chunk MC-56774 I was playing minecraft PC, and these chunks were not loading. This is happening with all new updates with me MC-57349 Chunck generating can fail if moving towards posetive X MC-57722 Same Name Old Copy MC-57768 World not generating correctly MC-59297 Biomes No Longer Blend Properly Into Each Other MC-59794 huge bug MC-59863 Newly spawned worlds in 14w27a have some biome chunk errors MC-61705 Unnatural Chunk Loading MC-61874 Superflat still generates regular chuncks MC-61952 Customized worlds sometimes generate wrong MC-62544 World Generation Issue 19w29b MC-62884 Superflat Generation Error MC-63338 Deep ocean Biome cut off MC-63658 Chunks loaded incorrectly MC-63675 World not generate right. MC-63863 Terrain generation bug (forest + plains chunk dont merge naturally) MC-63864 Unlit blocks bug MC-64112 Failed terrain generation MC-72261 New map glitch MC-74412 World Mixtures MC-78282 World generation glitch? Normal world generated with debug world MC-79179 Chunks raised from the ground MC-80653 Superflat world with a piece of normal world in it. MC-81634 New Hardcore World has achievements from deleted hardcore world MC-81881 Bug with worlds. MC-86230 Bug generation map MC-91356 Village Bug MC-94668 Chunks Being Weird (Not The Normal Chunk Error) MC-96152 I'm very concerned about what has happened to my game.There are strange walls surrounding my world with trees,oceans,plants,and animals behind these walls. MC-105341 I logged in to my new server and I started see some world generator bugs: MC-106255 bug chunk MC-113219 Pls fix asap MC-114284 Chunk generating around World MC-130354 Hardcore Worlds are not deleted upon death and clicking "Delete World"

Attachments

Comments

migrated
[media][media][media]
Selbram (Tory Clement)

Could not duplicate in 1.4.2 client single player.

Mortvert (Mort Imert)

I had the same thing happen.
Restarting minecraft and trying to delete the world did work.

Erik Broes

We need some more information on how to reproduce this error. I'm unable to reproduce it myself 😞

Alex Campbell

This happens if you have the world open in a different Minecraft instance, with no visible error message.

Nerdyboy6057

How are you deleting the world (are you deleting it in-game or through file deletion)? If you are deleting the file itself and not through the Delete button in-game, the world will still be listed until you reload the world list. This is possibly because the list is not live; it fetches the files when it is loaded and then is static.

kumasasa

Steps to reproduce:

  • Create a world

  • Leave the world

  • Create another world

  • Leave the world

  • Delete first world

  • Delete second world
    Remains of second world (region/r0.0.mca) still on harddisk.
    Console logfile of above procedure with several error messages ("yr: Failed to check session lock, aborting") is attached.

Tails

Related to MC-315.

bugi74

Reproduction
In order to reproduce, no need to create two worlds. Simply starting the creation of a world and then as soon as possible, "save and quit" and go to delete that same world.

Depending on the exact timings, user can get (at least) two different types of console logs. (Or with superfast computer, third case: success).

One case is similar to what Kumasasa has shown: lots of "Failed to check session lock, aborting", apparently one message per chunk being saved (without success). In this case, the session.lock file has been successfully deleted. The end result is a lingering region/r.0.0.mca file (or perhaps another name depending on players initial location).

The other case is when the deletion process does not complete properly, again due to saving process on the background. In this case, there will be two lingering files, the session.lock, and the region/r.0.0.mca. I've attached a log snippet 'deleting-world-fail.txt' showing this case.

Root cause
The root cause is that the change to use "integrated server" is not completed fully; world creation and saving is done in the server (own thread), but deletion is still done in the client (another thread), asynchronously from the server and without knowing/checking hows it going with server. The server in turn can not know when the last/only user to quit the world simply wants to drop it all, and thus it has to always save the world. The saving takes a bit of time, enough for the user to reach deletion at the same time.

(Edit: seems the deletion process does some kind of try to enforce/check that saving is completed, but I guess it is not working as expected. Looks like it will only try to enforce closing any region files still open. That is not very graceful, as it does not check whether some other thread is still trying to write to them.)

Possible fix
A fix would likely include adding a check and set of session lock in the deletion routine. This would enforce waiting until the server has finished saving. A crude fix will try a number of times and fail silently (the world stays in the list). More polished fix would tell the user that the world is currently locked ("in use") and it is retrying for a short period, and if failing, tells the user to retry a bit later.

(Edit: if in single-player both the client and the server somehow would share the session lock, the above idea will not work, as both would already have the session lock and be happy. Maybe better idea would be to improve the method that tries to release all the region files so that it waits until it is actually ok to release them (no pending writes).)

Edit2: I managed to enforce the deletion to work properly by adding an enforced flush() before deletion (in GuiSelectWorld by MCP naming), but this in turn causes lots of ugly console stacktraces ("The save is being accessed from another location, aborting"). Nevertheless, it apparently manages to delay the deletion just enough that the saving processes have finished/cancelled themselves.

Well while the reason is now clear, the code and fix are not so much, so I'll leave the rest for Mojang.

Note
The related MC-315 still needs a check and proper cleanup of the save directory, so that already failed deletions and their left-overs can be handled properly. And there is no saying that there isn't or never will be any other deletion failures (say, a crash during deletion), so it would be some good added robustness.

bugi74

Affects 13w09b.

Roxas Kingdem

Maybe use Java 7 kit 13 or 15 , use the highest

bugi74

This is not a bug by Java, but in the Minecraft code, see my long explanation and testing fixes above.

bugi74

Reproduction hint
See my longer explanation above, but for Mojang specifically: add additional delays/micro-sleeps into the saving methods to artificially slow it down to levels of the computers owned by us mortals. Will be easier to do the reproduction (more time to do the necessary clicks). On my own computer (which isn't the latest and greatest, but not slow, either), I am sometimes half a second too slow to trigger the problem.

Kelton Chesshire

Sorry guys for the long wait for a response, I was having MAJOR issues involving my computer. But I am finally able to say that this issue has been fixed, I checked and it actually had to do with the computer that I was using, so sorry for the inconvenience!

EDIT: Actually, now that I think about it, there DOES seem to be a small issue with worlds not deleting. I have been experiencing this since Beta 1.8. I would go into my .minecraft\saves directory, and the world that I THOUGHT was deleted was actually still there, just not popping up in the client.

bugi74

Did you by chance improve your computer when solving those issues? As hinted above by me, a fast enough computer might not have these world deletion problems. That is why I hinted the devs to add extra delays to the save routines to "simulate" ordinary (i.e. slow) PCs, so they can reproduce the problem easier.

Kelton Chesshire

Recently my computer has actually been working sometimes and not others. When this problem occurred the computer I was using was actually quite fast, but still the worlds wouldn't delete. Same goes for the computer I have now.

crazyman

This is happened to me all back from version beta 1.5! This is really old bug and should be fixed!!

Ezekiel

Cannot reproduce in the latest version of minecraft

bugi74

Could still reproduce in 1.6.2. Follow the reproduction instructions in my earlier comment and needs a bit of quick clicking (or slower machine). Having the development console now in the launcher makes it even easier to notice when/how the deletion fails...

...
Client> 2013-07-12 08:43:22 [SERVER] [INFO] Starting integrated minecraft server version 1.6.2
...
Client> Unsuccessful in deleting contents.
Client> Attempt 5...
Client> Deleting C:\Users\markkuh\AppData\Roaming\.minecraft\saves\deltest1\region
Client> Deleting C:\Users\markkuh\AppData\Roaming\.minecraft\saves\deltest1\region\r.-1.0.mca
Client> Couldn't delete file C:\Users\markkuh\AppData\Roaming\.minecraft\saves\deltest1\region\r.-1.0.mca
Client> Couldn't delete directory C:\Users\markkuh\AppData\Roaming\.minecraft\saves\deltest1\region
Client> Unsuccessful in deleting contents.
kumasasa

Reopened, see MC-315

Jeuv

Reproduced in 13w42a. Quite tricky to do so, though.

kumasasa

@Jeff Claessen: Please attach the complete output of the "Development console" tab of the launcher.

  • Click the text, press CTRL-A to select all, then CTRL-C to copy, and CTRL-V to paste in a comment on this ticket.

Jeuv

Repruduced in both ways. The first time it showed exactly the same as in Markku's latest comment, the second time it spammed my console with:

Client> [22:26:22] [Server thread/ERROR]: Couldn't save chunk; already in use by another instance of Minecraft?
Client> afp: Failed to check session lock, aborting
Client> 	at awv.c(SourceFile:70) ~[13w42b.jar:?]
Client> 	at afk.F(SourceFile:2352) ~[13w42b.jar:?]
Client> 	at aop.a(SourceFile:90) ~[13w42b.jar:?]
Client> 	at mh.b(SourceFile:146) [13w42b.jar:?]
Client> 	at mh.a(SourceFile:175) [13w42b.jar:?]
Client> 	at mi.a(SourceFile:603) [13w42b.jar:?]
Client> 	at net.minecraft.server.MinecraftServer.a(SourceFile:277) [13w42b.jar:?]
Client> 	at net.minecraft.server.MinecraftServer.n(SourceFile:297) [13w42b.jar:?]
Client> 	at bsb.n(SourceFile:225) [13w42b.jar:?]
Client> 	at net.minecraft.server.MinecraftServer.run(SourceFile:390) [13w42b.jar:?]
Client> 	at kx.run(SourceFile:617) [13w42b.jar:?]
bugi74

The "Failed to check session lock, aborting" is revealing, and has been caught before (see earlier comments). There is basically two ways to fail (two different patterns of log), depending on the exact timings between the two processes going on. End result is still the same, failure.

Ezekiel

Is this still a concern in the latest Minecraft version 14w03b? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

kumasasa

@unknown: Please attach the development console when having this issue.

Deleted account

@unknown: Can't get it to work right now, I'll try again tomorrow.

kumasasa

No need to, I had the issue right now:

[01:26:00 INFO]: Client> [01:26:00] [Server thread/INFO]: Preparing spawn area: 95%
[01:26:01 INFO]: Client> [01:26:01] [Server thread/INFO]: Changing view distance to 12, from 10
[01:26:01 INFO]: Client> [01:26:01] [Server thread/INFO]: Kumasasa[local:E:47b547ea] logged in with entity id 573 at (-123.5, 71.0, 260.5)
[01:26:01 INFO]: Client> [01:26:01] [Server thread/INFO]: Kumasasa joined the game
[01:26:07 INFO]: Client> [01:26:07] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 4896ms behind, skipping 97 tick(s)
[01:26:10 INFO]: Client> [01:26:10] [Client thread/INFO]: [CHAT] You do not have permission to use this command
[01:26:12 INFO]: Client> [01:26:12] [Client thread/INFO]: Warning: Clientside chunk ticking took 125 ms
[01:26:12 INFO]: Client> [01:26:12] [Server thread/INFO]: Saving and pausing game...
[01:26:12 INFO]: Client> [01:26:12] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[01:26:16 INFO]: Client> [01:26:16] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[01:26:16 INFO]: Client> [01:26:16] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[01:26:17 INFO]: Client> [01:26:17] [Server thread/INFO]: Kumasasa lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
[01:26:17 INFO]: Client> [01:26:17] [Server thread/INFO]: Kumasasa left the game
[01:26:17 INFO]: Client> [01:26:17] [Server thread/INFO]: Stopping singleplayer server as player logged out
[01:26:18 INFO]: Client> [01:26:18] [Client thread/INFO]: Deleting level New World
[01:26:18 INFO]: Client> [01:26:18] [Client thread/INFO]: Attempt 1...
[01:26:18 INFO]: Client> [01:26:18] [Client thread/WARN]: Couldn't delete file C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region\r.-1.0.mca
[01:26:18 INFO]: Client> [01:26:18] [Client thread/WARN]: Couldn't delete directory C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region
[01:26:18 INFO]: Client> [01:26:18] [Client thread/WARN]: Unsuccessful in deleting contents.
[01:26:19 INFO]: Client> [01:26:19] [Client thread/INFO]: Attempt 2...
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Couldn't delete file C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region\r.-1.0.mca
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Couldn't delete directory C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Unsuccessful in deleting contents.
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Stopping server
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Saving players
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Saving worlds
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[01:26:19 INFO]: Client> [01:26:19] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[01:26:19 INFO]: Client> [01:26:19] [Client thread/INFO]: Attempt 3...
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Couldn't delete file C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region\r.-1.0.mca
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Couldn't delete directory C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region
[01:26:19 INFO]: Client> [01:26:19] [Client thread/WARN]: Unsuccessful in deleting contents.
[01:26:20 INFO]: Client> [01:26:20] [Client thread/INFO]: Attempt 4...
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Couldn't delete file C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region\r.-1.0.mca
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Couldn't delete directory C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Unsuccessful in deleting contents.
[01:26:20 INFO]: Client> [01:26:20] [Client thread/INFO]: Attempt 5...
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Couldn't delete file C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region\r.-1.0.mca
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Couldn't delete directory C:\Users\Ivo\AppData\Roaming\.minecraft\saves\New World\region
[01:26:20 INFO]: Client> [01:26:20] [Client thread/WARN]: Unsuccessful in deleting contents.

Created again "New World" and having mixed flatland and default world type:

[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Starting integrated minecraft server version 14w04b
[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Generating keypair
[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Converting map!
[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Scanning folders...
[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Total conversion count is 0
[01:26:50 INFO]: Client> [01:26:50] [Server thread/INFO]: Preparing start region for level 0
[01:26:51 INFO]: Client> [01:26:51] [Server thread/INFO]: Changing view distance to 12, from 10
[01:26:51 INFO]: Client> [01:26:51] [Server thread/INFO]: Kumasasa[local:E:76ba54ad] logged in with entity id 3267 at (35.5, 73.0, 71.5)
[01:26:51 INFO]: Client> [01:26:51] [Server thread/INFO]: Kumasasa joined the game
[01:27:02 INFO]: Client> [01:27:02] [Server thread/INFO]: Saving and pausing game...
[01:27:02 INFO]: Client> [01:27:02] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[01:27:02 INFO]: Client> [01:27:02] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[01:27:02 INFO]: Client> [01:27:02] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[01:27:48 INFO]: Client> [01:27:48] [Server thread/INFO]: Saving and pausing game...
[01:27:48 INFO]: Client> [01:27:48] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[01:27:48 INFO]: Client> [01:27:48] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[01:27:48 INFO]: Client> [01:27:48] [Server thread/INFO]: Saving chunks for level 'New World'/The End
marcono1234

Can't really reproduce in 1.8.7

Is it possible to provide other steps to reproduce it? I know that I had this in the past as well but I don't know what caused it

bugi74

Marcono1234, see 8th and 12th comments. At least one way (that worked back then). However, it was tricky to execute, requiring some care with (quite fast) timing, at least on my PC. (EDIT: remembered this the wrong way around: Slower computers might trip on this more easily, faster ones perhaps nearly never.) Slower computers might perhaps nevery trip on this easily, faster ones could be easier to get hit by this. Even if the root cause would not be fixed yet, changes in other processes related to saving and deletion of worlds could now hide the issue, either completely or just make it rarer event (and that much more difficult to find and fix properly).

marcono1234

I tried the 8th comment but when I click to early "Save and Quit to Title" Minecraft just stops responding for some seconds

bugi74

Ooops, I wrote/remembered that the wrong way around. Slow computers might get enough delay in leaving the game, so that server has time to finish saving, and thus deletion will succeed. It is the fast computers (and with quick users) that may reach the deletion too quickly. (Even with my relatively fast computer, after learning where to move the mouse to "blind click" the right places, I could not reproduce this on every try.)

Reproducing this issue easily and predictably requires (or required) tweaking the code a bit; that would be for the devs to do, whenever, if ever... For this particular bug, the expected status should be always "still broken unless devs actually inform to have tried to fix it", as it is too difficult for the users to verify.

marcono1234

Confirmed for

  • 1.10 using a Minecraft version decompiled by MCP 9.30

Like @unknown said, the problem is that deleting a world is client-side and does not test if the server already finished saving the world. This can be reproduced by having the method net.minecraft.server.MinecraftServer.stopServer() wait for some seconds before starting to save the level.

bugi74

A late idea for a solution base: move the deletion activity to server-side, while a client only requests the server to do that action. Server can then decide (if or) when it will fulfill that request. In single-player mode this may still be a bit iffy to do, depending on how its "server" gets started and/or connected; with brute-force implementation, it might create another server instance (while the old one still saving and shutting down), and you'd still have the root cause of two processes not knowing about each other or their states.

In any case, it would be closer to the correct solution, using the chosen client-server -model for this action, too, even in single-player.

marcono1234

The client thread could maybe call the join() method of the server thread. This way the client continues once the server thread finished. But then the client would appear as not responding. Maybe the server should call a method of the client once it finished saving. Until then the client displays some GUI and waits for the server.

Leo-Or Zyngier

its still a bug but it shouldn't bother you to much because you can delete it from the saves folder i think it just might be a problem that for some reason you computer didn't "want" to delete the file

Kraif

Cannot reproduce for 1.13.1, is anyone else able to reproduce it?

bugi74

I can not test this on my current setup as easily any more, as I now have quite a bit faster SSD than few years ago, so any saving will happen in a blink (thus preventing this bug to appear). Also, the user interface was slooow this time, giving more time for the saving to finish (as if it even needed it); no idea if that was due to my setup or changes in the game.

That is, whether the bug is fixed or not, I would not be able to get this bug to happen at current setup. I would either need to change things so that saves go to a slower device (HDD), or spend lots of time to decompile etc. and tweak the saving process to be artificially slower.  Not going to waste my time with the latter any more, so have to try by changing the save directory to a HDD... some day Soon(tm).

user-2a4c8

confirmed 19w13b. Created a world, joined it, left, clicked delete after clicking it, and it would freeze for a moment than still hang around. I believe it has something to do with the game hanging onto some files not allowing them to be deleted since they are still being used. You can not delete the world from the saves folder either unless you close the game.

bugi74

Assuming they haven't changed the deletion process since... years... the two ways/reasons why things fail have been figured out (buried in the comments of this and the related issue). Also some ways to work around them (at code level) have been provided (but not a nice proper fix, as that would have been too big a change to be shown here). This bug is mostly waiting for some developer to fix it (at least a workaround, but even a proper solution is not really that difficult), or users to just confirm they still find the symptoms.

galaxy_2alex

I'm unable to reproduce this on 1.14-pre5 on a slow harddrive, can someone else still reproduce this? If so, I will make you the reporter of this ticket so you can keep it updated.

Arisa Bot

This report is currently missing crucial information. Please take a look at the other comments to find out what we are looking for.
If you added the required information and a moderator sees your comment, they will reopen and update the report. However, if you think your update to this report has been overlooked or you want to make sure that this report is reopened, you can contact the Mojira staff on Discord or Reddit.
-- I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit

Kelton Chesshire

(Unassigned)

Confirmed

(Unassigned)

client, delete, server, world

Minecraft 1.4.1, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02b, Snapshot 13w09a, ..., Minecraft 1.8.8, Minecraft 1.10.2, Minecraft 1.11.2, Minecraft 18w06a, Minecraft 18w21b

Retrieved