PaperMC / PaperMC/Paper

Support `despawn-time` for entities in weakly loaded chunks, resolve lag and crashes from weak chunk entity stacking

Open
#13,783 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
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.

Image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.