20w17a, 1.16.2, 1.16.3, 1.16.4, 20w46a, 20w49a, 1.17 Release Candidate 1, 1.17, 1.17.1 Release Candidate 1, 1.17.1, 21w37a, 21w39a, 21w40a, 21w44a
Windows 10, Java 1.8.0_51 64bit
This is likely related to
MC-177664. I am creating this issue to provide more context and a save file to demonstrate the issue.
In short, when the limit of 247 sounds is exceeded, the client stalls and writes the following to the console several thousands of times:
Maximum sound pool size 247 reached
Failed to create new sound handle
Once the sounds are within the limit, the client responds again.
When the client is stalled, the internal (or dedicated for multiplayer) server is still running, which can be demonstrated by the attached save file.
The limit can be reached during normal play when making a rabbit farm. I originally ran into the issue when building a rabbit farm similar to this one on a small multiplayer server. While populating the farm, my client stalled. I forced the game to close, then ran into the same problem each time I logged on again. While logged on, with the client stalling, I used the server console to teleport my player away from the farm, which made my client instantly respond again.
From my testing, the issue is only present from snapshot 20w09a onward. Previous versions force the number of sounds down before exceeding the limit.
The "Sound Overload Demo 20w09a.zip" contains 4 contraptions to show the issue. To the south is 2 contraptions that show the number of sounds from a single rabbit and a single cow (using f3, cow maxes out at 3, rabbit maxes out at 12). In the middle is a contraption like the rabbit farm with 72 rabbits that stalls the game for a few seconds before redstone removes the water to lower the sounds. To the north is a contraption with 432 chickens that causes the game to stall very briefly.
The "Sound Overload Demo 1_15_2.zip" has the same contraption that lags the game in the snapshots, but in 1.15.2 to show how the game handled the issue in previous versions.