Content-Length: 240273 | pFad | http://github.com/tokio-rs/tokio/issues/7131

89 `EXC_BAD_ACCESS (SIGSEGV)` on `UnboundedSender::send` · Issue #7131 · tokio-rs/tokio · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS (SIGSEGV) on UnboundedSender::send #7131

Open
thomaseizinger opened this issue Jan 28, 2025 · 2 comments
Open

EXC_BAD_ACCESS (SIGSEGV) on UnboundedSender::send #7131

thomaseizinger opened this issue Jan 28, 2025 · 2 comments
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-sync Module: tokio/sync

Comments

@thomaseizinger
Copy link

Version:

`cargo tree | grep tokio`
❯ cargo tree | grep tokio
│   └── tokio v1.42.0
│       └── tokio-macros v2.4.0 (proc-macro)
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   └── tokio-stream v0.1.17
│   │   │   │   │       └── tokio v1.42.0 (*)
│   │   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   │   ├── tokio-util v0.7.12
│   │   │   │   │   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   └── tokio v1.42.0 (*)
│   │   │   ├── tokio v1.42.0 (*)
│   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   │   ├── tokio-rustls v0.26.0
│   │   │   │   │   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   │   ├── tokio-rustls v0.26.0 (*)
│   │   │   │   │   │   ├── tokio-util v0.7.12 (*)
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   └── tokio v1.42.0 (*)
│   │   │   │   │       │   ├── tokio v1.42.0 (*)
│   │   │   │   │       ├── tokio v1.42.0 (*)
│   │   │   │   │       ├── tokio-stream v0.1.17 (*)
│   │   │   │   │       │   ├── tokio v1.42.0 (*)
│   │   │   │   │       │   ├── tokio-util v0.7.12 (*)
│   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   ├── tokio-tungstenite v0.23.1
│   │   │   │   │   ├── tokio v1.42.0 (*)
│   │   │   │   │   ├── tokio-rustls v0.26.0 (*)
│   │   │   │   └── tokio v1.42.0 (*)
│   │   │   ├── tokio v1.42.0 (*)
│   ├── tokio v1.42.0 (*)
├── tokio v1.42.0 (*)
├── tokio v1.42.0 (*)
├── tokio v1.42.0 (*)
│   │   ├── tokio v1.42.0 (*)
│   │   ├── tokio-stream v0.1.17 (*)
│   │   ├── tokio-util v0.7.12 (*)
│   ├── tokio v1.42.0 (*)
│   ├── tokio-stream v0.1.17 (*)
│   ├── tokio v1.42.0 (*)
│   └── tokio v1.42.0 (*)
├── tokio v1.42.0 (*)
├── tokio-util v0.7.12 (*)
└── tokio v1.42.0 (*)

Platform

macOS 15.2.0 (24C101)

Description

EXC_BAD_ACCESS error on UnboundedSender::send.

Stacktrace
OS Version: macOS 15.2.0 (24C101)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: SEGV_NOOP at 0x00000000000001c8
Crashed Thread: 8

Application Specific Information:
Exception 1, Code 1, Subcode 456 >
KERN_INVALID_ADDRESS at 0x1c8.

Thread 8 Crashed:
0 dev.firezone.firezone.network-extension0x20e045d97 tokio::sync::mpsc::unbounded::UnboundedSender::send
1 dev.firezone.firezone.network-extension0x20dfd7486 swift_bridge$WrappedSession$set_dns
2 dev.firezone.firezone.network-extension0x20deb7aeb [inlined] WrappedSessionRefMut.setDns (connlib-client-apple.swift:50)
3 dev.firezone.firezone.network-extension0x20deb7aeb Adapter.didReceivePathUpdate (Adapter.swift:329)
4 dev.firezone.firezone.network-extension0x20deb71ab closure in Adapter.beginPathMonitoring (Adapter.swift:254)
5 Network 0xfff025c5daab objectdestroy.53Tm
6 Network 0xfff025c7b168 block_destroy_helper.59
7 libdispatch.dylib 0xfff0168bb454 _dispatch_call_block_and_release
8 libdispatch.dylib 0xfff0168bc7e1 _dispatch_client_callout
9 libdispatch.dylib 0xfff0168c2979 _dispatch_lane_serial_drain
10 libdispatch.dylib 0xfff0168c3439 _dispatch_lane_invoke
11 libdispatch.dylib 0xfff0168cd25b _dispatch_root_queue_drain_deferred_wlh
12 libdispatch.dylib 0xfff0168ccb5c _dispatch_workloop_worker_thread
13 libsystem_pthread.dylib 0xfff016c05c7e _pthread_wqthread
14 libsystem_pthread.dylib 0xfff016c04bda start_wqthread

Thread 0
0 libsystem_kernel.dylib 0xfff016b91d4a __sigsuspend_nocancel
1 libdispatch.dylib 0xfff0168cd4a7 _dispatch_sig_thread

Thread 1
0 libsystem_kernel.dylib 0xfff016b8e976 __semwait_signal
1 libsystem_c.dylib 0xfff016969189 sleep
2 dev.firezone.firezone.network-extension0x20e5ab04f monitorCachedData
3 libsystem_pthread.dylib 0xfff016c09252 _pthread_start
4 libsystem_pthread.dylib 0xfff016c04bee thread_start

Thread 2 name: SentryCrash Exception Handler (Secondary)
0 libsystem_kernel.dylib 0xfff016b8bf0e mach_msg2_trap
1 libsystem_kernel.dylib 0xfff016b93015 mach_msg_overwrite
2 libsystem_kernel.dylib 0xfff016b8c1fe mach_msg
3 dev.firezone.firezone.network-extension0x20e58f7e8 handleExceptions
4 libsystem_pthread.dylib 0xfff016c09252 _pthread_start
5 libsystem_pthread.dylib 0xfff016c04bee thread_start

Thread 4 name: tracing-appender
0 libsystem_kernel.dylib 0xfff016b8be8a semaphore_wait_trap
1 libdispatch.dylib 0xfff0168bd1a6 _dispatch_semaphore_wait_slow
2 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::sys::sync::thread_parking::darwin::Parker::park (darwin.rs:74)
3 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::thread::Thread::park (mod.rs:1446)
4 dev.firezone.firezone.network-extension0x20e45cdee std::thread::park (mod.rs:1084)
5 dev.firezone.firezone.network-extension0x20e07b3da crossbeam_channel::context::Context::wait_until.3719
6 dev.firezone.firezone.network-extension0x20e07ab12 crossbeam_channel::flavors::array::Channel::recv::{{closure}}
7 dev.firezone.firezone.network-extension0x20e0758a5 tracing_appender::worker::Worker::worker_thread::{{closure}}
8 dev.firezone.firezone.network-extension0x20e075568 std::sys::backtrace::__rust_begin_short_backtrace
9 dev.firezone.firezone.network-extension0x20e0752c0 core::ops::function::FnOnce::call_once{{vtable.shim}}
10 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
11 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
12 dev.firezone.firezone.network-extension0x20e491eea std::sys::pal::unix::thread::Thread::new::thread_start (thread.rs:105)
13 libsystem_pthread.dylib 0xfff016c09252 _pthread_start
14 libsystem_pthread.dylib 0xfff016c04bee thread_start

Thread 5 name: tracing-appender
0 libsystem_kernel.dylib 0xfff016b8be8a semaphore_wait_trap
1 libdispatch.dylib 0xfff0168bd1a6 _dispatch_semaphore_wait_slow
2 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::sys::sync::thread_parking::darwin::Parker::park (darwin.rs:74)
3 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::thread::Thread::park (mod.rs:1446)
4 dev.firezone.firezone.network-extension0x20e45cdee std::thread::park (mod.rs:1084)
5 dev.firezone.firezone.network-extension0x20e07b3da crossbeam_channel::context::Context::wait_until.3719
6 dev.firezone.firezone.network-extension0x20e07ab12 crossbeam_channel::flavors::array::Channel::recv::{{closure}}
7 dev.firezone.firezone.network-extension0x20e0758a5 tracing_appender::worker::Worker::worker_thread::{{closure}}
8 dev.firezone.firezone.network-extension0x20e075568 std::sys::backtrace::__rust_begin_short_backtrace
9 dev.firezone.firezone.network-extension0x20e0752c0 core::ops::function::FnOnce::call_once{{vtable.shim}}
10 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
11 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
12 dev.firezone.firezone.network-extension0x20e491eea std::sys::pal::unix::thread::Thread::new::thread_start (thread.rs:105)
13 libsystem_pthread.dylib 0xfff016c09252 _pthread_start
14 libsystem_pthread.dylib 0xfff016c04bee thread_start

Thread 6 name: futures-timer
0 libsystem_kernel.dylib 0xfff016b8be8a semaphore_wait_trap
1 libdispatch.dylib 0xfff0168bd1a6 _dispatch_semaphore_wait_slow
2 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::sys::sync::thread_parking::darwin::Parker::park (darwin.rs:74)
3 dev.firezone.firezone.network-extension0x20e45cdee [inlined] std::thread::Thread::park (mod.rs:1446)
4 dev.firezone.firezone.network-extension0x20e45cdee std::thread::park (mod.rs:1084)
5 dev.firezone.firezone.network-extension0x20e19a5f4 std::sys::backtrace::__rust_begin_short_backtrace
6 dev.firezone.firezone.network-extension0x20e19a373 core::ops::function::FnOnce::call_once{{vtable.shim}}
7 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
8 dev.firezone.firezone.network-extension0x20e491eea [inlined] alloc::boxed::Box::call_once (boxed.rs:1972)
9 dev.firezone.firezone.network-extension0x20e491eea std::sys::pal::unix::thread::Thread::new::thread_start (thread.rs:105)
10 libsystem_pthread.dylib 0xfff016c09252 _pthread_start
11 libsystem_pthread.dylib 0xfff016c04bee thread_start

Thread 7
0 CoreFoundation 0xfff016d0f47c __CFStringAppendFormatCore
1 CoreFoundation 0xfff016e396cd _CFStringCreateWithFormatAndArgumentsReturningMetadata
2 CoreFoundation 0xfff016d0f0ce _CFStringCreateWithFormatAndArgumentsAux2
3 Foundation 0xfff018d9d907 -[NSPlaceholderString initWithFormat:locale:arguments:]
4 Foundation 0xfff018dabbba +[NSString stringWithFormat:]
5 dev.firezone.firezone.network-extension0x20e5d3982 -[SentryFileManager uniqueAscendingJsonName]
6 dev.firezone.firezone.network-extension0x20e5d5236 -[SentryFileManager storeEnvelope:]
7 dev.firezone.firezone.network-extension0x20e59e054 __36-[SentryHttpTransport sendEnvelope:]_block_invoke
8 dev.firezone.firezone.network-extension0x20e553a25 __53-[SentryDispatchQueueWrapper dispatchAsyncWithBlock:]_block_invoke
9 libdispatch.dylib 0xfff0168bb454 _dispatch_call_block_and_release
10 libdispatch.dylib 0xfff0168bc7e1 _dispatch_client_callout
11 libdispatch.dylib 0xfff0168c2979 _dispatch_lane_serial_drain
12 libdispatch.dylib 0xfff0168c3439 _dispatch_lane_invoke
13 libdispatch.dylib 0xfff0168cd25b _dispatch_root_queue_drain_deferred_wlh
14 libdispatch.dylib 0xfff0168ccb5c _dispatch_workloop_worker_thread
15 libsystem_pthread.dylib 0xfff016c05c7e _pthread_wqthread
16 libsystem_pthread.dylib 0xfff016c04bda start_wqthread

Thread 8 Crashed:
0 dev.firezone.firezone.network-extension0x20e045d97 tokio::sync::mpsc::unbounded::UnboundedSender::send
1 dev.firezone.firezone.network-extension0x20dfd7486 swift_bridge$WrappedSession$set_dns
2 dev.firezone.firezone.network-extension0x20deb7aeb [inlined] WrappedSessionRefMut.setDns (connlib-client-apple.swift:50)
3 dev.firezone.firezone.network-extension0x20deb7aeb Adapter.didReceivePathUpdate (Adapter.swift:329)
4 dev.firezone.firezone.network-extension0x20deb71ab closure in Adapter.beginPathMonitoring (Adapter.swift:254)
5 Network 0xfff025c5daab objectdestroy.53Tm
6 Network 0xfff025c7b168 block_destroy_helper.59
7 libdispatch.dylib 0xfff0168bb454 _dispatch_call_block_and_release
8 libdispatch.dylib 0xfff0168bc7e1 _dispatch_client_callout
9 libdispatch.dylib 0xfff0168c2979 _dispatch_lane_serial_drain
10 libdispatch.dylib 0xfff0168c3439 _dispatch_lane_invoke
11 libdispatch.dylib 0xfff0168cd25b _dispatch_root_queue_drain_deferred_wlh
12 libdispatch.dylib 0xfff0168ccb5c _dispatch_workloop_worker_thread
13 libsystem_pthread.dylib 0xfff016c05c7e _pthread_wqthread
14 libsystem_pthread.dylib 0xfff016c04bda start_wqthread

Thread 9
0 libsystem_kernel.dylib 0xfff016b8c962 close
1 NetworkExtension 0xfff03c87c7fb NEVirtualInterfaceAdjustReadBufferSize
2 NetworkExtension 0xfff03c87c47a NEVirtualInterfaceTearDown
3 CoreFoundation 0xfff016e2983c _CFRelease
4 NetworkExtension 0xfff03c816530 -[NEPacketTunnelFlow closeVirtualInterface]
5 NetworkExtension 0xfff03c6d1790 -[NEExtensionPacketTunnelProviderContext dispose]
6 Foundation 0xfff018e53f6c NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S0
7 Foundation 0xfff0197c6ccc -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:]
8 Foundation 0xfff0197c8615 message_handler_message
9 Foundation 0xfff018db208c message_handler
10 libxpc.dylib 0xfff0166125ef _xpc_connection_call_event_handler
11 libxpc.dylib 0xfff016611005 _xpc_connection_mach_event
12 libdispatch.dylib 0xfff0168bc87b _dispatch_client_callout4
13 libdispatch.dylib 0xfff0168d5856 _dispatch_mach_msg_invoke
14 libdispatch.dylib 0xfff0168c27ae _dispatch_lane_serial_drain
15 libdispatch.dylib 0xfff0168d63a0 _dispatch_mach_invoke
16 libdispatch.dylib 0xfff0168c27ae _dispatch_lane_serial_drain
17 libdispatch.dylib 0xfff0168c3439 _dispatch_lane_invoke
18 libdispatch.dylib 0xfff0168cd25b _dispatch_root_queue_drain_deferred_wlh
19 libdispatch.dylib 0xfff0168ccb5c _dispatch_workloop_worker_thread
20 libsystem_pthread.dylib 0xfff016c05c7e _pthread_wqthread
21 libsystem_pthread.dylib 0xfff016c04bda start_wqthread

Thread 10
0 libsystem_pthread.dylib 0xfff016c04bcc start_wqthread

Thread 8 crashed with x86 Thread State (32-bit):
r10: 0x000000000000005d r11: 0x0000000000000043 r12: 0x0000000000000000 r13: 0x00007fde4e50a7d0
r14: 0x00007000017d4378 r15: 0x0000000000000001 r8: 0x000000000000005d r9: 0x0000000000000002
rax: 0x0000000000000000 rbp: 0x00007000017d42d0 rbx: 0x00007000017d4330 rcx: 0x0000000000000002
rdi: 0x00007000017d4330 rdx: 0x00007000017d4378rflags: 0x0000000000010206 rip: 0x000000010e045d97
rsi: 0x0000600003e29478 rsp: 0x00007000017d42a0 cs: 0x000000000000002b fs: 0x0000000000000000
gs: 0x0000000000000000

EOF

The type that is sent through the channel is here: https://github.com/firezone/firezone/blob/macos-client-1.4.0/rust/connlib/clients/shared/src/eventloop.rs#L29-L36

That is unfortunately all the info I have. This stacktrace came from a crash report from one of our users. It also only happened once.

@thomaseizinger thomaseizinger added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Jan 28, 2025
@thomaseizinger thomaseizinger changed the title EXC_BAD_ACCESS (SIGSEGV) on UnboundedSender::send EXC_BAD_ACCESS (SIGSEGV) on UnboundedSender::send Jan 28, 2025
@Darksonn Darksonn added the M-sync Module: tokio/sync label Jan 28, 2025
@Darksonn
Copy link
Contributor

Based on the information you have shared, it seems most likely that this is not a Tokio bug. This error can happen if, for example, you use unsafe code to run the destructor of the UnboundedSender and then attempt to use it afterwards.

@thomaseizinger
Copy link
Author

Okay, thanks for the info! I'll dig into that direction! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-sync Module: tokio/sync
Projects
None yet
Development

No branches or pull requests

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/tokio-rs/tokio/issues/7131

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy