[LIRC-2] irc.c: Partial reads occur occasionally
Occasionally, particularly when the client starts up and there is a lot of chatter, some messages get fragmented across reads.
Here, the first message ends with "s" and "uccessfully" gets split into the read. (This seems to be happening more often recently due to some newly added extensions by Libera Chat). This was observed multiple times (not all shown here), where one read would just return "uccessful" and we would try parsing that. What we should be doing is having waited previously before parsing for the "uccessful CR LF".
lirc in theory is supposed to handle partial reads, but this seems to be an edge case it isn't handling properly. Originally, this led to a crash when parsing truncated/incomplete messages ([LIRC-1]), though this was addressed in the patch for that issue.
From LBBS:
[2026-02-21 04:16:50.833] -- @time=2026-02-21T04:16:50.793Z :cadmium.libera.chat 900 PhreakNetBBS PhreakNetBBS!PhreakNetB@user/PhreakNetBBS PhreakNetBBS :You are now logged in as PhreakNetBBS
@time=2026-02-21T04:16:50.793Z :cadmium.libera.chat 903 PhreakNetBBS :SASL authentication s[2026-02-21 04:16:50.833] NOTICE[3459528]: irc.c:812 irc_client_login: Logged in to irc.libera.chat as PhreakNetBBS successfully
[2026-02-21 04:16:50.833] -- Started 1 IRC client
[2026-02-21 04:16:50.834] DEBUG[3459528]: mod_chanserv.c:1099 chanserv_init: Preparing query 'SELECT name, topic, modelock, guard, keeptopic FROM channels WHERE guard > ?'
[2026-02-21 04:16:50.834] DEBUG[3459528]: mod_chanserv.c:1130 chanserv_init: Processing channel #phreaknet
[2026-02-21 04:16:50.834] DEBUG[3459528]: mod_chanserv.c:1133 chanserv_init: Joining channel #phreaknet
[2026-02-21 04:16:50.834] DEBUG[3459528]: mod_chanserv.c:92 chanserv_send: <= JOIN #phreaknet
[2026-02-21 04:16:50.834] DEBUG[3459528]: net_irc.c:3254 find_or_create_channel_locked: Creating channel '#phreaknet' for the first time
[2026-02-21 04:16:50.834] DEBUG[3459528]: socket.c:2865 bbs_auto_any_fd_writef: Discarding write output (no node and no fd)
[2026-02-21 04:16:50.834] DEBUG[3459528]: net_irc.c:1182 __channel_broadcast: (1/0) <= :ChanServ!ChanServ@services JOIN #phreaknet
[2026-02-21 04:16:50.835] DEBUG[3459528]: mod_irc_relay.c:816 netirc_cb: Not relaying JOIN message 'ChanServ!ChanServ@services has joined #phreaknet' due to startupjoinignore setting.
[2026-02-21 04:16:50.835] DEBUG[3459528]: net_irc.c:3185 send_channel_members: 0x7f32fa1be860 <= 353 ChanServ = #phreaknet :@ChanServ
[2026-02-21 04:16:50.835] DEBUG[3459528]: socket.c:2865 bbs_auto_any_fd_writef: Discarding write output (no node and no fd)
[2026-02-21 04:16:50.835] DEBUG[3459528]: mod_irc_relay.c:602 nicklist: Numeric: 353, channel: #phreaknet, user: , nick: , client:
[2026-02-21 04:16:50.835] DEBUG[3459528]: mod_irc_relay.c:623 nicklist: Relaying nicknames from libera/#phreaknet
[2026-02-21 04:16:50.835] DEBUG[3459559]: thread.c:106 thread_register: Thread 3459559 spawned from client_relay started by thread 3459528 at mod_irc_client.c:271 start_irc_clients()
[2026-02-21 04:16:51.263] ERROR[3459559]: irc.c:1023 irc_parse_msg_type: IRC message has no bodyComments
You must be logged in to leave a comment.