SwiftNIOExtras/swift-nio-irc

`IRCMessageParser` hang

helje5 opened this issue · 2 comments

The parser seems to hang sometimes in:

(gdb) thread 2
[Switching to thread 2 (Thread 0x7fd62b892700 (LWP 27415))]
#0  0x000055df495c921b in _T06NIOIRC16IRCMessageParserV4feedy3NIO10ByteBufferV_yAC5ErrorOSg_AA0B0VSgt_tc5yieldtFys09UnsafeRawG7PointerVcfU_Tf4xnn_n ()
(gdb) bt
#0  0x000055df495c921b in _T06NIOIRC16IRCMessageParserV4feedy3NIO10ByteBufferV_yAC5ErrorOSg_AA0B0VSgt_tc5yieldtFys09UnsafeRawG7PointerVcfU_Tf4xnn_n ()
#1  0x000055df495ca6d6 in _T06NIOIRC16IRCMessageParserV4feedy3NIO10ByteBufferV_yAC5ErrorOSg_AA0B0VSgt_tc5yieldtFTf4ggn_n ()
#2  0x000055df495b729e in _T06NIOIRC17IRCChannelHandlerC11channelReady3NIO07ChannelC7ContextC3ctx_AE6NIOAnyV4datatF ()
#3  0x000055df495b799e in _T06NIOIRC17IRCChannelHandlerC3NIO015_ChannelInboundC0AadEP11channelReadyAD0eC7ContextC3ctx_AD6NIOAnyV4datatFTW ()
#4  0x000055df494eeb3c in _T03NIO21ChannelHandlerContextC06invokeB4Read33_EEC863903996E9F191EBAFEB0FB0DFDDLLyAA6NIOAnyVF ()
#5  0x000055df494e382d in _T03NIO22_ChannelInboundHandlerPAAE11channelReadyAA0bD7ContextC3ctx_AA6NIOAnyV4datatF ()
#6  0x000055df494e3be9 in _T03NIO19BackPressureHandlerCAA015_ChannelInboundD0A2aDP11channelReadyAA0eD7ContextC3ctx_AA6NIOAnyV4datatFTW ()
#7  0x000055df494eeb3c in _T03NIO21ChannelHandlerContextC06invokeB4Read33_EEC863903996E9F191EBAFEB0FB0DFDDLLyAA6NIOAnyVF ()
#8  0x000055df49567e3d in _T03NIO13SocketChannelC08readFromB0AA04BasebC0C10ReadResultOyAA0B0C_GyKF ()
#9  0x000055df49513d17 in _T03NIO19SelectableEventLoopC06handleC033_D5D78C61B22284700B9BD1ACFBC25157LLyAA08SelectorC3SetV_x7channeltAA0B7ChannelRzlFAA06SocketP0C_Tg5Tf4ngd_n ()
#10 0x000055df4950d88f in _T03NIO19SelectableEventLoopC3runyyKFyyKcfU_yAA08SelectorC0VyAA15NIORegistrationOGcfU_ ()
#11 0x000055df4951a2cc in _T03NIO19SelectableEventLoopC3runyyKFyyKcfU_yAA08SelectorC0VyAA15NIORegistrationOGcfU_TA ()
#12 0x000055df4955d6df in _T03NIO8SelectorC9whenReadyyAA0B8StrategyO8strategy_yAA0B5EventVyxGKctKFAA15NIORegistrationO_Tg509_T03NIO13bg6VyAA15H32OGs5Error_pIgxzo_AFsAG_pIgizo_TRAIyALGs0N0_pIgxzo_Tf1ncn_n ()
#13 0x000055df4950d4a5 in _T03NIO19SelectableEventLoopC3runyyKF ()
#14 0x000055df49516ae2 in _T03NIO27MultiThreadedEventLoopGroupC014setupThreadAnddE033_D5D78C61B22284700B9BD1ACFBC25157LLAA010SelectabledE0CSS4name_yAA0H0Cc11initializertFZyAJcfU_Tf4gndnnn_n ()
#15 0x000055df4951a292 in _T03NIO27MultiThreadedEventLoopGroupC014setupThreadAnddE033_D5D78C61B22284700B9BD1ACFBC25157LLAA010SelectabledE0CSS4name_yAA0H0Cc11initializertFZyAJcfU_TA ()
#16 0x000055df4951a2b4 in _T03NIO6ThreadCIegx_ACytIegir_TRTA ()
#17 0x000055df4957008c in _T03NIO6ThreadC11spawnAndRunySSSg4name_yACc4bodytFZSvSgAHcfU_ ()
#18 0x000055df495700c9 in _T03NIO6ThreadC11spawnAndRunySSSg4name_yACc4bodytFZSvSgAHcfU_To ()
#19 0x00007fd6345136ba in start_thread (arg=0x7fd62b892700) at pthread_create.c:333
#20 0x00007fd63338741d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

This lets miniircd spin and consume 100% CPU.

Probably related to this stdout log:

Eliza is ready and listening!
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
BRIDGE could not register: IRC.IRCClient
RUN Started Mon Oct 29 09:51:55 UTC 2018
 __  __ _       _ _____ _____   _____
 |  \/  (_)     (_)_   _|  __ \ / ____|   Swift IRCd
 | \  / |_ _ __  _  | | | |__) | |
 | |\/| | | '_ \| | | | |  _  /| |        Port: 6667
 | |  | | | | | | |_| |_| | \ \| |____    PID:  7
 |_|  |_|_|_| |_|_|_____|_|  \_\\_____|

Ready to accept connections on: [IPv4]0.0.0.0:6667
IRCWebClientServer running on: [IPv4]0.0.0.0:80
Eliza is ready and listening!
ERROR: Protocol error, sending unknown cmd invalidCommand(37 bytes)
BRIDGE could not register: IRC.IRCClient
RUN Started Thu Nov 29 15:30:49 UTC 2018
 __  __ _       _ _____ _____   _____
 |  \/  (_)     (_)_   _|  __ \ / ____|   Swift IRCd
 | \  / |_ _ __  _  | | | |__) | |
 | |\/| | | '_ \| | | | |  _  /| |        Port: 6667
 | |  | | | | | | |_| |_| | \ \| |____    PID:  7
 |_|  |_|_|_| |_|_|_____|_|  \_\\_____|

Ready to accept connections on: [IPv4]0.0.0.0:6667
IRCWebClientServer running on: [IPv4]0.0.0.0:80
Eliza is ready and listening!

Should be fixed.