Skip to content

Call blocking events on virtual threads#13816

Open
masmc05 wants to merge 1 commit intoPaperMC:mainfrom
masmc05:vthreads
Open

Call blocking events on virtual threads#13816
masmc05 wants to merge 1 commit intoPaperMC:mainfrom
masmc05:vthreads

Conversation

@masmc05
Copy link
Copy Markdown
Contributor

@masmc05 masmc05 commented Apr 23, 2026

As briefly mentioned on discord, bukkit currently doesn't have support for proper async events. Currently events where it is recommended to block the thread (like async configuration event in order to wait for a dialog response) will block a platform thread until the plugin is finished/user decided to respond. As an alternative calling those events from virtual threads makes blocking much cheaper.

CONFIGURATION_POOL is currently used for:

  • calling AsyncPlayerConnectionConfigureEvent (potential blocking for dialog response waiting, resource pack response waiting)
  • calling AsyncPlayerSpawnLocationEvent (potential blocking for database lookup of a spawn location, no join event happened for preload)

authenticatorPool is currently used for:

  • http calls for mojang authentication (guaranteed blocking)
  • AsyncPlayerPreLoginEvent (potential blocking for data load as it's first event)
  • Profile completion (blocking)
  • waiting for PlayerPreLoginEvent to finish (guaranteed blocking if has listeners)

Both have no workload that would require a platform thread, and both benefits from calling the blocking logic in a virtual thread

@masmc05 masmc05 requested a review from a team as a code owner April 23, 2026 21:11
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Apr 23, 2026
@Owen1212055
Copy link
Copy Markdown
Member

I agree 100% with making the config phase use virtual threads, I am not sure about the login event just due to HOW long its been around. However, it seems fair, and would be really nice,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

3 participants