Multiple observed crashes in the same scenario (we do a FETCHLIST, and the expected number of messages is not returned (specifically, none end up being returned), so we retry, but that also fails).
It seems plausible that because no messages were returned, the set pointer is not valid, even though it is non-NULL.
[2025-06-29 08:44:54.455] DEBUG[218477]: net_imap.c:4993 handle_client: 0x7fc3d5fd8870 => 15 FETCH 24:48 (UID FLAGS INTERNALDATE RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Date Subject From To X-Priority Importance X-MSMail-Priority Priority)])
[2025-06-29 08:44:54.459] DEBUG[217778]: net_imap.c:1371 select_examine_response: 0x7fc3c97f7870 <= * OK [MYRIGHTS "lrswipkxteacd"] ACL
[2025-06-29 08:44:54.473] DEBUG[218477]: net_imap.c:4127 flush_updates: 0x7fc3d5fd8870 <= * STATUS "Trash" (MESSAGES 61 UIDNEXT 1521 UNSEEN 0 HIGHESTMODSEQ 59)
[2025-06-29 08:44:54.477] DEBUG[217778]: net_imap.c:1379 select_examine_response: 0x7fc3c97f7870 <= 59 OK [READ-WRITE] SELECT completed
[2025-06-29 08:44:54.486] DEBUG[218477]: net_imap.c:4127 flush_updates: 0x7fc3d5fd8870 <= * STATUS "Trash" (MESSAGES 62 UIDNEXT 1522 UNSEEN 0 HIGHESTMODSEQ 59)
[2025-06-29 08:44:54.490] DEBUG[217778]: net_imap.c:4993 handle_client: 0x7fc3c97f7870 => 60 FETCH 27:51 (UID FLAGS INTERNALDATE RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Date Subject From To X-Priority Importance X-MSMail-Priority Priority)])
[2025-06-29 08:44:54.497] DEBUG[218477]: net_imap.c:4127 flush_updates: 0x7fc3d5fd8870 <= * STATUS "Trash" (MESSAGES 63 UIDNEXT 1523 UNSEEN 0 HIGHESTMODSEQ 59)
[2025-06-29 08:44:54.502] WARNING[217778]: net_imap.c:4111 flush_updates: Client has a stale view of sequence numbers, rejecting unsynchronized command
[2025-06-29 08:44:54.513] DEBUG[217778]: net_imap.c:4112 flush_updates: 0x7fc3c97f7870 <= 60 NO Out of synchronization, run NOOP and retry request
[2025-06-29 08:44:54.514] DEBUG[218477]: readline.c:173 bbs_readline: bbs_poll_read returned 0
[2025-06-29 08:44:54.525] WARNING[217777]: mod_webmail.c:2391 fetchlist: FETCH failed [25: MAILIMAP_ERROR_FETCH]: 60, Out of synchronization, run NOOP and retry request
[2025-06-29 08:44:54.527] DEBUG[218477]: fd.c:479 __bbs_mark_closed: Marking file descriptor 138 as closed
BBS server disconnected
Thread 1 (Thread 0x7fc3d1fd3700 (LWP 217777)):
#0 0x00007fc40d3dbc7d in mailimap_msg_att_free (msg_att=0x7fc300000000) at mailimap_types.c:1739
#1 0x00007fc40d3c57d1 in clist_foreach (lst=lst@entry=0x7fc3e817ccb0, func=0x7fc40d3dbc70 <mailimap_msg_att_free>, data=data@entry=0x0) at clist.c:221
cur = 0x7fc3e81b15c0
#2 0x00007fc40d3cb4e2 in mailimap_fetch_list_free (fetch_list=0x7fc3e817ccb0) at mailimap.c:1468
#3 0x00007fc40d481e00 in fetchlist (filter=<optimized out>, sort=<optimized out>, numpages=<optimized out>, pagesize=<optimized out>, page=<optimized out>, end=51, start=27, reason=<optimized out>, client=0x7fc3e8109d00, ws=<optimized out>) at mod_webmail.c:2405
#4 handle_fetchlist (ws=<optimized out>, client=client@entry=0x7fc3e8109d00, reason=<optimized out>, reason@entry=0x7fc40d4861ff "FETCH", page=<optimized out>, pagesize=<optimized out>, sort=<optimized out>, filter=<optimized out>) at mod_webmail.c:2528
#5 0x00007fc40d484a2f in on_poll_activity (data=0x7fc3e8109d00, ws=<optimized out>) at mod_webmail.c:3901
Recurrence:
[2025-07-12 08:05:58.196] DEBUG[236682]: imap_client.c:593 client_command_passthru: <= * OK [UIDNEXT 2023] The next unique identifier value
[2025-07-12 08:05:58.221] DEBUG[236682]: net_imap.c:4993 handle_client: 0x7f1f667d1870 => 34 FETCH 1 (UID FLAGS INTERNALDATE RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Date Subject From To X-Priority Importance X-MSMail-Priority Priority)])
[2025-07-12 08:05:58.225] DEBUG[236682]: imap_client.c:727 __imap_client_send_wait_response: => 34 FETCH 1 (UID FLAGS INTERNALDATE RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Date Subject From To X-Priority Importance X-MSMail-Priority Priority)])
[2025-07-12 08:05:58.299] WARNING[236682]: imap_client.c:605 client_command_passthru: Command '34 FETCH 1 (UID FLAGS INTERNALDATE RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Date Subject From To X-Priority Importance X-MSMail-Priority Priority)])' failed: 34 NO The specified message set is invalid.
[2025-07-12 08:05:58.341] WARNING[236681]: mod_webmail.c:2391 fetchlist: FETCH failed [25: MAILIMAP_ERROR_FETCH]: 34, The specified message set is invalid.
BBS server disconnected
Thread 1 (Thread 0x7f1f6bfdf700 (LWP 236681)):
#0 0x00007f1fa6288c7d in mailimap_msg_att_free (msg_att=0x0) at mailimap_types.c:1739
#1 0x00007f1fa62727d1 in clist_foreach (lst=lst@entry=0x7f1f58530280, func=0x7f1fa6288c70 <mailimap_msg_att_free>, data=data@entry=0x0) at clist.c:221
cur = 0x7f1f588ad360
#2 0x00007f1fa62784e2 in mailimap_fetch_list_free (fetch_list=0x7f1f58530280) at mailimap.c:1468
#3 0x00007f1fa632ee00 in fetchlist (filter=<optimized out>, sort=<optimized out>, numpages=<optimized out>, pagesize=25, page=<optimized out>, end=1, start=1, reason=<optimized out>, client=0x7f1f8fd05dc0, ws=<optimized out>) at mod_webmail.c:2405
#4 handle_fetchlist (ws=ws@entry=0x7f1f6bfdbf60, client=client@entry=0x7f1f8fd05dc0, reason=<optimized out>, reason@entry=0x7f1f8d30e4c0 "SELECT", page=<optimized out>, pagesize=pagesize@entry=25, sort=<optimized out>, sort@entry=0x0, filter=<optimized out>) at mod_webmail.c:2528
#5 0x00007f1fa63301cf in on_text_message (ws=ws@entry=0x7f1f6bfdbf60, data=0x7f1f8fd05dc0, buf=<optimized out>, len=len@entry=107) at mod_webmail.c:4046
You must be