Support `despawn-time` for entities in weakly loaded chunks, resolve lag and crashes from weak chunk entity stacking
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
A large number of drops, projectiles and entities have accumulated in weakly loaded chunks, causing severe server lag or crashes.
I run a survival server. Most of the time, players don’t mean any harm; they just don’t load those chunks, but this ends up causing the server to reach 1000+ MSPT or Crash.
The image shows 260,000 item drops in a single weakly loaded chunk. Due to the chunk being weakly loaded, the items don't reach the destination fire in time to be destroyed.
https://mclo.gs/x8DEF6W
fix https://mojira.dev/MC-301664
Describe the solution you'd like.
If the entities-spawning-despawn-time provided by Paper works for entities in weakly loaded chunks, it will solve this lag and crash issue.
Describe alternatives you've considered.
null
Other
If implementing this feature would be invasive, perhaps an option could be provided instead.
Entities in weakly loaded chunks do not enter the save phase, so the entity-per-chunk-save-limit option has no effect.
Replace https://github.com/PaperMC/Paper/issues/12986
This lag and crash scenario is quite likely to occur. Water streams and pistons can move item entities quickly, and many mobs shoot projectiles. Given sufficient playtime, it can easily happen.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how entities in weakly loaded chunks are ticked and despawned, then compare that path with the entities-spawning-despawn-time setting and the entity-per-chunk-save-limit behavior. Use MC-301664 as context; done means the despawn-time setting applies to these entities and prevents the described accumulation, lag, or crash scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100