#3814: Fire exception in pipeline if async task in eventloop throws exception

This commit is contained in:
Valentine 2025-04-12 10:10:51 +03:00 committed by GitHub
parent f6151dce56
commit 1da3a8c240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 14 deletions

View File

@ -334,7 +334,7 @@ public final class UserConnection implements ProxiedPlayer
{ {
Preconditions.checkNotNull( request, "request" ); Preconditions.checkNotNull( request, "request" );
ch.getHandle().eventLoop().execute( () -> connect0( request ) ); ch.scheduleIfNecessary( () -> connect0( request ) );
} }
private void connect0(final ServerConnectRequest request) private void connect0(final ServerConnectRequest request)

View File

@ -2,7 +2,6 @@ package net.md_5.bungee.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.netty.channel.EventLoop;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -901,17 +900,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
return (result, error) -> return (result, error) ->
{ {
EventLoop eventLoop = ch.getHandle().eventLoop(); ch.scheduleIfNecessary( () ->
if ( eventLoop.inEventLoop() )
{
if ( !ch.isClosing() )
{
callback.done( result, error );
}
return;
}
eventLoop.execute( () ->
{ {
if ( !ch.isClosing() ) if ( !ch.isClosing() )
{ {

View File

@ -238,6 +238,12 @@ public class ChannelWrapper
return; return;
} }
ch.eventLoop().execute( task ); ch.eventLoop().submit( task ).addListener( future ->
{
if ( !future.isSuccess() )
{
ch.pipeline().fireExceptionCaught( future.cause() );
}
} );
} }
} }