mojira.dev
MC-164316

Resource pack update by a hash doesn't work

The bug

When specifying a resource pack URL and checksum / hash in the server.properties and the client detects that the checksum does not match for an existing resource pack, it fails deleting it, because the file is already being used by another process.

[20:58:22] [Client thread/WARN]: File \.minecraft\server-resource-packs\d31664486132157cf0f82534f1d1c66f75411418 had wrong hash (expected 6a0fc6c57023a7a47d9abc463090dcd28f3fa7aa, found 1b88a157a6edaa6d332a6fe65baa2fd73895ac9a).
[20:58:22] [Client thread/WARN]: Pack application failed: Hash check failure for file \.minecraft\server-resource-packs\d31664486132157cf0f82534f1d1c66f75411418, see log, deleting file \.minecraft\server-resource-packs\d31664486132157cf0f82534f1d1c66f75411418
[20:58:22] [Client thread/WARN]: Failed to delete file \.minecraft\server-resource-packs\d31664486132157cf0f82534f1d1c66f75411418: \.minecraft\server-resource-packs\d31664486132157cf0f82534f1d1c66f75411418: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.

Code analysis

In the method clientPackSource.clearServerPack() only the reference to the UnopenedResourcePack is removed, but the pack is not closed before.

Linked issues

Comments 24

Can you provide some more details, i.e., what are you trying to do, what exactly needs to be done to reproduce this issue, are you sure you don't have the resource pack open in the explorer, etc?

I changed the resource package. However, the same URL is used. Just pass the new hash (checksum) of the file. The client then noticed that the hash does not match the local one. And want to re-download the resource package. The client could not delete the old one because it was already in use (Still loaded).

I hadn't opened the file or folder.

Each time the player enters the server, a request will be sent to him that he should load the resource package. Along with the current hash of the file on the host

I may have found the problem.
In the method clientPackSource.clearServerPack() only the reference to the UnopenedResourcePack is removed, but the pack is not closed before.

14 more comments

Adding a comment to say that this issue still occurs in 1.19.
The workaround I have found is to send a different URL with the new hash to the client, this causes the old pack to be correctly deleted and the new one to be downloaded and applied correctly.

@SyntheticDev this workaround was posted earlier in this thread, you can just append the hash at the end of the url like this:

http://example.com/resourcepack.zip#ABCD1234

Can confirm for 1.19.2

Can confirm in 1.19.3 and 1.19.4

Can confirm 23w44a

Foorcee

(Unassigned)

Community Consensus

Platform

Low

Resource Packs

1.14.4, 1.15 Pre-release 3, 1.15 Pre-release 4, 1.15 Pre-release 5, 1.15, ..., 1.17, 1.19, 1.19.2, 1.19.4, 23w44a

1.20.3 Pre-Release 1

Retrieved