mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Log exceptions thrown during chat processing (#7467)
This commit is contained in:
parent
ea776989ad
commit
1586de3418
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bjarne Koll <git@lynxplay.dev>
|
||||
Date: Sat, 12 Feb 2022 03:20:36 +0100
|
||||
Subject: [PATCH] Log exceptions thrown during chat processing
|
||||
|
||||
Previously the async chat executor service would take chat handling
|
||||
using the #submit method, which wraps the logic in a future task.
|
||||
The future takes full ownership of the task, including any potential
|
||||
exception, meaning that the uncaught exception handler never gets
|
||||
notified about potential exceptions thrown during async chat logic.
|
||||
|
||||
As the chat task does neither need to be cancelled nor returns something
|
||||
required later on, this commit moves from #submit to #execute, skipping
|
||||
any future task creation. This properly propagates any exception upwards
|
||||
to the worker thread in the executor service, allowing the server to
|
||||
catch and properly log the exception to the console.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
@@ -0,0 +0,0 @@ public class ServerboundChatPacket implements Packet<ServerGamePacketListener> {
|
||||
public void handle(final ServerGamePacketListener listener) {
|
||||
if ( !this.message.startsWith("/") )
|
||||
{
|
||||
- ServerboundChatPacket.executors.submit( new Runnable()
|
||||
+ ServerboundChatPacket.executors.execute( new Runnable() // Paper - Use #execute to propagate exceptions up instead of swallowing them
|
||||
{
|
||||
|
||||
@Override
|
Loading…
Reference in New Issue
Block a user