Skip to content

Fix PWT deadlock with plugin sync tasks#766

Open
wling-art wants to merge 9 commits into
Winds-Studio:ver/26.1.2from
wling-art:fix/pwt-sync-task-deadlock
Open

Fix PWT deadlock with plugin sync tasks#766
wling-art wants to merge 9 commits into
Winds-Studio:ver/26.1.2from
wling-art:fix/pwt-sync-task-deadlock

Conversation

@wling-art

@wling-art wling-art commented Jun 5, 2026

Copy link
Copy Markdown
Member

PWT 下,MinecraftServer#tickChildren 分发 tick 各自的线程时,主线程则硬阻塞等待全部完成,会卡在 tasks.pop().get()

当插件(例如 MythicMobs)在某个世界 tick 线程里调用 callSyncAndJoin() 会通过 Bukkit.getScheduler().runTask() 把任务丢进 CraftScheduler 队列,然后阻塞等结果。

而该队列只在 tickChildren 开头跑一次 heartbeat,此时主线程卡死了,世界线程等主线程跑任务、主线程等世界线程跑完导致了互锁。

解决方法

把任务在对应世界 tick 内联执行(不丢回主线程了)。


fix: #728

@Dreeam-qwq Dreeam-qwq added the type: fix Pull request for fixing bug label Jun 7, 2026
@NeglectDream

Copy link
Copy Markdown

经测试issue内的那种mythicmobs的报错没了,现在换了几种新崩服报错
https://mclo.gs/S6IJjD7
https://mclo.gs/3rVtwlY

还有两种新的crash报错
https://mclo.gs/1UvdOdU

@NeglectDream

Copy link
Copy Markdown

经测试mythicmobs的报错回来了
https://mclo.gs/8svXRRZ

@NeglectDream

NeglectDream commented Jun 14, 2026

Copy link
Copy Markdown

https://github.com/Winds-Studio/Leaf/actions/runs/27474418760
经测试崩溃,但是是全新的日志
https://mclo.gs/vfohYw5

刚发现这个插件还留着,现在已经删了用gamerule了,顺便留了个样本
[自动重生]AutoRespawn.jar.zip

@wling-art

wling-art commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

https://github.com/Winds-Studio/Leaf/actions/runs/27474418760 经测试崩溃,但是是全新的日志 https://mclo.gs/vfohYw5

刚发现这个插件还留着,现在已经删了用gamerule了,顺便留了个样本 [自动重生]AutoRespawn.jar.zip

mythicmobs 这插件太黑箱了,我得花点时间想想怎么办了。

@NeglectDream

Copy link
Copy Markdown

https://github.com/Winds-Studio/Leaf/actions/runs/27474418760 经测试崩溃,但是是全新的日志 https://mclo.gs/vfohYw5
刚发现这个插件还留着,现在已经删了用gamerule了,顺便留了个样本 [自动重生]AutoRespawn.jar.zip

这插件太黑箱了,我得花点时间想想怎么办了。

刚才看了一下代码,这插件在玩家死的时候延迟1tick调用player.spawn方法来复活
(历史遗留的垃圾,现在我已经删了用gamerule来实现了,我再测测有没有其他问题)

@NeglectDream

Copy link
Copy Markdown

经测试还是会崩,下面是日志
https://mclo.gs/PQG8t4J

@wling-art wling-art changed the base branch from ver/1.21.11 to ver/26.1.2 June 16, 2026 01:04

@Dreeam-qwq Dreeam-qwq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tql

@Dreeam-qwq Dreeam-qwq requested a review from HaHaWTH June 16, 2026 01:28
@NeglectDream

Copy link
Copy Markdown

经测试有时候会出现下面的报错
但是对服务器无实际影响
https://mclo.gs/d8CUnpF

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

Labels

type: fix Pull request for fixing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PWT崩服

3 participants