Oswald Buddenhagen via isync-devel <[email protected]> writes:
> On Wed, Jun 03, 2026 at 07:46:57PM -0400, Perry Fraser wrote:
>>The only other detail is it seems very rare that this issue will
>>reproduce itself when only syncing with the gmail channel, which is
>>why the above output is both an iCloud and a gmail sync.
>>
> this suggests possible undefined behavior. try injecting
> valgrind/memcheck into the call, or building with -fsanitize=address
> -fsanitize=undefined (the latter should change the timing less, but it
> won't catch the issue if it's in a library, say openssl).
No luck reproducing the issue with an address sanitizer, but the
undefined sanitizer gave some very promising output; see attached.
> also compare the lsof output for the mbsync processes in the different
> contexts. maybe there is an inherited file descriptor that somehow
> gets misused.
I've also attached a log of what the two outputs look like.
Thanks,
― Perry
When run within emacs, I consistently get this output from lsof:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF
NODE NAME
mbsync 40782 perry cwd DIR 1,14 3648
332362 /Users/perry/Downloads
mbsync 40782 perry txt REG 1,14 1784600
6944776 /usr/local/bin/mbsync
mbsync 40782 perry txt REG 1,14 147984
5421565 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/libsasl2.3.dylib
mbsync 40782 perry txt REG 1,14 72744
6606224 /Library/Preferences/Logging/.plist-cache.zliYb3XL
mbsync 40782 perry txt REG 1,14 88816
5421568 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libgssapiv2.3.so
mbsync 40782 perry txt REG 1,14 70736
5421524 /opt/homebrew/Cellar/krb5/1.22.2/lib/libcom_err.3.0.dylib
mbsync 40782 perry txt REG 1,14 95584
5421533 /opt/homebrew/Cellar/krb5/1.22.2/lib/libkrb5support.1.1.dylib
mbsync 40782 perry txt REG 1,14 52496
5421202 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libcrammd5.3.so
mbsync 40782 perry txt REG 1,14 2357376
1152921500312572606 /usr/lib/dyld
mbsync 40782 perry txt REG 1,14 884560
4044148 /opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib
mbsync 40782 perry txt REG 1,14 196624
5421527 /opt/homebrew/Cellar/krb5/1.22.2/lib/libk5crypto.3.1.dylib
mbsync 40782 perry txt REG 1,14 87392
5421570 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libscram.3.so
mbsync 40782 perry txt REG 1,14 73632
5421567 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libgs2.3.so
mbsync 40782 perry txt REG 1,14 104512
5421569 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libotp.3.so
mbsync 40782 perry txt REG 1,14 52240
5421212 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libplain.3.so
mbsync 40782 perry txt REG 1,14 4845712
4044147 /opt/homebrew/Cellar/openssl@3/3.6.2/lib/libcrypto.3.dylib
mbsync 40782 perry txt REG 1,14 1790672
818608
/Library/Developer/CommandLineTools/usr/lib/clang/21/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib
mbsync 40782 perry txt REG 1,14 53056
5423853 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libxoauth2.0.so
mbsync 40782 perry txt REG 1,14 53216
5421214 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libsasldb.3.so
mbsync 40782 perry txt REG 1,14 324416
5421525 /opt/homebrew/Cellar/krb5/1.22.2/lib/libgssapi_krb5.2.2.dylib
mbsync 40782 perry txt REG 1,14 32768
6607080 /private/var/db/mds/messages/501/se_SecurityMessages
mbsync 40782 perry txt REG 1,14 106016
5421566 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libdigestmd5.3.so
mbsync 40782 perry txt REG 1,14 52368
5421200 /opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libanonymous.3.so
mbsync 40782 perry txt REG 1,14 166059
6885230 /private/var/db/analyticsd/events.allowlist
mbsync 40782 perry txt REG 1,14 787792
5421532 /opt/homebrew/Cellar/krb5/1.22.2/lib/libkrb5.3.3.dylib
mbsync 40782 perry 0u CHR 16,7 0t1333
1251 /dev/ttys007
mbsync 40782 perry 1u CHR 16,7 0t1333
1251 /dev/ttys007
mbsync 40782 perry 2u CHR 16,7 0t1333
1251 /dev/ttys007
mbsync 40782 perry 3 PIPE 0x7ec0a8c878eba1d0 16384
->0x9ef30eade1a368f8
mbsync 40782 perry 4 PIPE 0x9ef30eade1a368f8 16384
->0x7ec0a8c878eba1d0
mbsync 40782 perry 5u IPv4 0x6fa6351b2d87df6e 0t0
TCP perrys-mbp.fios-router.home:57954->17.57.156.25:imaps (ESTABLISHED)
mbsync 40782 perry 6u REG 1,14 16
5400385 /Users/perry/.maildir/icloud/Archive/.uidvalidity
mbsync 40782 perry 7w REG 1,14 0
6958238 /Users/perry/.maildir/icloud/Archive/.mbsyncstate.lock
mbsync 40782 perry 14r REG 1,14 1250480
1152921500312350002
/System/Library/PrivateFrameworks/RenderBox.framework/Versions/A/Resources/default.metallib
mbsync 40782 perry 15u REG 1,14 2340
6956476
/private/var/folders/rq/nbjq66dj2l1945wxj7dqrrr00000gn/C/org.gnu.Emacs/com.apple.metal/16777235_355/functions.list
mbsync 40782 perry 16u systm 0x46f4914db6ad2efc 0t0
[ctl com.apple.netsrc id 7 unit 50]
mbsync 40782 perry 18r REG 1,14 142209
1152921500312148892
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
mbsync 40782 perry 19r REG 1,14 490410
1152921500312148843
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
mbsync 40782 perry 20u REG 1,14 131072
6956477
/private/var/folders/rq/nbjq66dj2l1945wxj7dqrrr00000gn/C/org.gnu.Emacs/com.apple.metal/16777235_355/functions.data
mbsync 40782 perry 21u REG 1,14 604
6956480
/private/var/folders/rq/nbjq66dj2l1945wxj7dqrrr00000gn/C/org.gnu.Emacs/com.apple.metal/32024/libraries.list
mbsync 40782 perry 22u REG 1,14 131072
6956482
/private/var/folders/rq/nbjq66dj2l1945wxj7dqrrr00000gn/C/org.gnu.Emacs/com.apple.metal/32024/libraries.data
================================================================================
When run from outside of emacs I get output that usually looks
something like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE
NAME
mbsync 40945 perry cwd DIR 1,14 1760 332311
/Users/perry
mbsync 40945 perry txt REG 1,14 1784600 6944776
/usr/local/bin/mbsync
mbsync 40945 perry txt REG 1,14 147984 5421565
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/libsasl2.3.dylib
mbsync 40945 perry txt REG 1,14 72744 6606224
/Library/Preferences/Logging/.plist-cache.zliYb3XL
mbsync 40945 perry txt REG 1,14 88816 5421568
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libgssapiv2.3.so
mbsync 40945 perry txt REG 1,14 884560 4044148
/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib
mbsync 40945 perry txt REG 1,14 32768 6607080
/private/var/db/mds/messages/501/se_SecurityMessages
mbsync 40945 perry txt REG 1,14 2357376 1152921500312572606
/usr/lib/dyld
mbsync 40945 perry txt REG 1,14 70736 5421524
/opt/homebrew/Cellar/krb5/1.22.2/lib/libcom_err.3.0.dylib
mbsync 40945 perry txt REG 1,14 95584 5421533
/opt/homebrew/Cellar/krb5/1.22.2/lib/libkrb5support.1.1.dylib
mbsync 40945 perry txt REG 1,14 87392 5421570
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libscram.3.so
mbsync 40945 perry txt REG 1,14 73632 5421567
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libgs2.3.so
mbsync 40945 perry txt REG 1,14 52496 5421202
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libcrammd5.3.so
mbsync 40945 perry txt REG 1,14 4845712 4044147
/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libcrypto.3.dylib
mbsync 40945 perry txt REG 1,14 1790672 818608
/Library/Developer/CommandLineTools/usr/lib/clang/21/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib
mbsync 40945 perry txt REG 1,14 324416 5421525
/opt/homebrew/Cellar/krb5/1.22.2/lib/libgssapi_krb5.2.2.dylib
mbsync 40945 perry txt REG 1,14 196624 5421527
/opt/homebrew/Cellar/krb5/1.22.2/lib/libk5crypto.3.1.dylib
mbsync 40945 perry txt REG 1,14 104512 5421569
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libotp.3.so
mbsync 40945 perry txt REG 1,14 52240 5421212
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libplain.3.so
mbsync 40945 perry txt REG 1,14 106016 5421566
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libdigestmd5.3.so
mbsync 40945 perry txt REG 1,14 53056 5423853
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libxoauth2.0.so
mbsync 40945 perry txt REG 1,14 53216 5421214
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libsasldb.3.so
mbsync 40945 perry txt REG 1,14 52368 5421200
/opt/homebrew/Cellar/cyrus-sasl/2.1.28_2/lib/sasl2/libanonymous.3.so
mbsync 40945 perry txt REG 1,14 787792 5421532
/opt/homebrew/Cellar/krb5/1.22.2/lib/libkrb5.3.3.dylib
mbsync 40945 perry txt REG 1,14 166059 6885230
/private/var/db/analyticsd/events.allowlist
mbsync 40945 perry 0u CHR 16,6 0t113984 999
/dev/ttys006
mbsync 40945 perry 1u CHR 16,6 0t113984 999
/dev/ttys006
mbsync 40945 perry 2u CHR 16,6 0t113984 999
/dev/ttys006
mbsync 40945 perry 3 PIPE 0x53ffc38f2d4f47a0 16384
->0x8f2b3216d79266cb
mbsync 40945 perry 4 PIPE 0x8f2b3216d79266cb 16384
->0x53ffc38f2d4f47a0
mbsync 40945 perry 5u IPv4 0xf79d01a8a000acfb 0t0 TCP
perrys-mbp.fios-router.home:57967->17.57.154.7:imaps (ESTABLISHED)
mbsync 40945 perry 6u REG 1,14 13 5400125
/Users/perry/.maildir/icloud/[Airmail]/Memo/.uidvalidity
mbsync 40945 perry 7w REG 1,14 0 6959227
/Users/perry/.maildir/icloud/[Airmail]/Memo/.mbsyncstate.l
Reading configuration file /Users/perry/.mbsyncrc
Channel icloud
Opening far side store icloud-remote...
Resolving imap.mail.me.com...
Opening near side store icloud-local...
Connecting to imap.mail.me.com (17.56.9.32:993)...
Connection is now encrypted
Logging in...
Authenticating with SASL mechanism PLAIN...
imap_msgs.c:28:38: runtime error: member access within null pointer of type
'imap_message_t' (aka 'union imap_message')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior imap_msgs.c:28:38
Opening far side box INBOX...
Opening near side box INBOX...
[...Several boxes sync successfully...]
Synchronizing...
Opening far side box Deleted Messages...
Opening near side box Deleted Messages...
Loading far side box...
far side: 0 messages, 0 recent
Loading near side box...
drv_maildir.c:1457:26: runtime error: member access within null pointer of type
'maildir_message_t' (aka 'union maildir_message')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior drv_maildir.c:1457:26
near side: 0 messages, 0 recent
Synchronizing...
[...Several boxes sync successfully...]
Synchronizing...
Channel gmail
Opening far side store gmail-remote...
Resolving imap.gmail.com...
Opening near side store gmail-local...
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==38355==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address
0x000108b50b81 (pc 0x000186caf090 bp 0x00016d98bd50 sp 0x00016d98bd40 T1584157)
==38355==The signal is caused by a READ memory access.
C: 1/3 B: 14/14 F: +0/0 *0/0 #0/0 -0/0 N: +0/0 *0/0 #0/0 -0/0
#0 0x000186caf090 in _os_log_find+0x40 (libsystem_trace.dylib:arm64e+0x4090)
#1 0x000186caedac in os_log_create+0x12c
(libsystem_trace.dylib:arm64e+0x3dac)
#2 0x000186fb0698 in gai_log_init+0x1c (libsystem_info.dylib:arm64e+0x19698)
#3 0x000186f83bb0 in __pthread_once_handler+0x44
(libsystem_pthread.dylib:arm64e+0x2bb0)
#4 0x000186f8ebb4 in _os_once_callout+0x1c
(libsystem_platform.dylib:arm64e+0xbb4)
#5 0x000186f8eb88 in _os_once+0x48 (libsystem_platform.dylib:arm64e+0xb88)
#6 0x000186f83b4c in pthread_once+0x60
(libsystem_pthread.dylib:arm64e+0x2b4c)
#7 0x000186fb0320 in _gai_nat64_second_pass+0x130
(libsystem_info.dylib:arm64e+0x19320)
#8 0x000186f9c864 in si_addrinfo+0x568 (libsystem_info.dylib:arm64e+0x5864)
#9 0x000186f9c250 in getaddrinfo+0xa8 (libsystem_info.dylib:arm64e+0x5250)
#10 0x000102485fb4 in socket_resolve+0x5a8 (mbsync:arm64+0x100019fb4)
#11 0x000102485610 in socket_connect+0x7a8 (mbsync:arm64+0x100019610)
#12 0x0001024b8470 in imap_connect_store+0x440 (mbsync:arm64+0x10004c470)
#13 0x0001025827dc in do_sync_chans+0x3260 (mbsync:arm64+0x1001167dc)
#14 0x0001025887f0 in sync_next_chan+0xac (mbsync:arm64+0x10011c7f0)
#15 0x000102587e88 in finalize_sync+0x1ba4 (mbsync:arm64+0x10011be88)
#16 0x00010258f7c4 in do_sync_boxes+0x268c (mbsync:arm64+0x1001237c4)
#17 0x0001025906f0 in done_sync+0x578 (mbsync:arm64+0x1001246f0)
#18 0x00010251a314 in sync_deref+0x220 (mbsync:arm64+0x1000ae314)
#19 0x000102514e14 in sync_bail3+0x20c (mbsync:arm64+0x1000a8e14)
#20 0x000102515e7c in sync_bail2+0x244 (mbsync:arm64+0x1000a9e7c)
#21 0x000102516474 in sync_bail+0x5e8 (mbsync:arm64+0x1000aa474)
#22 0x00010255b96c in box_closed_p2+0x43ac (mbsync:arm64+0x1000ef96c)
#23 0x0001025575a8 in box_closed+0x700 (mbsync:arm64+0x1000eb5a8)
#24 0x0001024ec310 in imap_close_box_simple_p2+0x1c8
(mbsync:arm64+0x100080310)
#25 0x0001024ce964 in done_imap_cmd+0x4f4 (mbsync:arm64+0x100062964)
#26 0x0001024ca134 in imap_socket_read+0x3cb8 (mbsync:arm64+0x10005e134)
#27 0x00010249386c in socket_filled+0xc4c (mbsync:arm64+0x10002786c)
#28 0x00010248ff90 in socket_fill+0x888 (mbsync:arm64+0x100023f90)
#29 0x00010248e5f0 in socket_fd_cb+0x77c (mbsync:arm64+0x1000225f0)
#30 0x000102477394 in event_wait+0x6cc (mbsync:arm64+0x10000b394)
#31 0x000102476cb4 in main_loop+0x54 (mbsync:arm64+0x10000acb4)
#32 0x00010257d94c in sync_chans+0xdc4 (mbsync:arm64+0x10011194c)
#33 0x00010257b320 in main+0x40d4 (mbsync:arm64+0x10010f320)
#34 0x000186bcbda0 in start+0x1b4c (dyld:arm64e+0x1fda0)
==38355==Register values:
x[0] = 0xb4216bfac192746a x[1] = 0x0000000000000026 x[2] =
0x0000000000000000 x[3] = 0x000000016d98bd8a
x[4] = 0x00000001044b8fc0 x[5] = 0x0000000000000000 x[6] =
0x0000000000000000 x[7] = 0xfffff0003ffff800
x[8] = 0x0000000108b50b7f x[9] = 0x00000001f2d944a8 x[10] =
0x0000000000000072 x[11] = 0x000000016d98bd84
x[12] = 0xad70642691c2bd5c x[13] = 0x00000000000022e4 x[14] =
0x0000000000000108 x[15] = 0x0020000200000000
x[16] = 0x000000018af5cb84 x[17] = 0x00000001f43c98e0 x[18] =
0x0000000000000000 x[19] = 0x000000016d98bd60
x[20] = 0x00000009b8cf8140 x[21] = 0x0000000186fc3b29 x[22] =
0x000000016d98bd60 x[23] = 0x000000000000001a
x[24] = 0x000000016d98bd64 x[25] = 0x0000000fffffc104 x[26] =
0x000000000000001a x[27] = 0x000000000000000c
x[28] = 0x0000000000000000 fp = 0x000000016d98bd50 lr =
0x0000000186caf078 sp = 0x000000016d98bd40
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV (libsystem_trace.dylib:arm64e+0x4090)
in _os_log_find+0x40
==38355==ABORTING
read: unexpected EOF
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel