zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.48k stars 3.02k forks source link

Crash when joining channel on macOS Catalina/BigSur #5384

Open JosephTLyons opened 9 months ago

JosephTLyons commented 9 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Discord user gabydd reported running into:

I have been getting a crash in livekit.multicast thread whenever I try to join a channel using 0.119.15, seeing as no one else has reported this maybe it's because I am on Catalina(10.15.7) on a pretty old MacBook Air(2014).

I will add if it's useful that I can use the chat and notes, just get the crash whenever I press the join channel.

I tried to debug this a little bit more, I made a new account and tried to use that to join a channel which also crashed and then I found out the crash also happens when trying to call.

They also experienced this issue on Big Sur

Environment

Zed: v0.119.16 (Zed Preview) OS: macOS 10.15.7 Memory: 4 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

crash.log

gabydd commented 9 months ago

I know this crash could be anything but this issue mentions an interesting bug in xcode 15: https://github.com/transmission/transmission/issues/6353

I couldn't find much else, I tried to use an much older build but as makes sense it's not possible to collaborate using too old of a build.

gabydd commented 9 months ago

https://github.com/zed-industries/zed/issues/4633 seems like it might be the same crash

ConradIrwin commented 9 months ago

@gabydd The good news is that I can reproduce this on Catalina! (The less good news, is I don't know how to fix it – yet!).

Spell28 commented 9 months ago

@gabydd I looked through the old correspondence history with my colleagues, where we were testing collaboration in Zed, and it turns out that on 01.12.2022, it was still working successfully on macOS Big Sur. Somewhere during the next six months, this crash appeared..

ConradIrwin commented 9 months ago

A lot has changed :D.

I know that they recently released a new LiveKit that may fix a different crash we were seeing, so I'll give that a go; but it's also possible that we've changed how we use it.

bitfield commented 2 months ago

Attaching my environment / crash log here for reference:

Environment

Zed: v0.149.5 (Zed) OS: macOS 10.15.7 Memory: 16 GiB Architecture: x86_64

macOS crash report:
Process:               zed [20453]
Path:                  /Applications/Zed.app/Contents/MacOS/zed
Identifier:            zed
Version:               0.149.5 (20240822.190532)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           zed [20453]
User ID:               501

Date/Time:             2024-08-25 13:21:16.594 +0100
OS Version:            Mac OS X 10.15.7 (19H2026)
Report Version:        12
Anonymous UUID:        8487B56D-2533-0BD8-952E-DE5454B7D930

Time Awake Since Boot: 350000 seconds

System Integrity Protection: enabled

Crashed Thread:        69  Dispatch queue: livekit.multicast

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [20453]

VM Regions Near 0:
-->
    __TEXT                 0000000103478000-000000010a264000 [109.9M] r-x/r-x SM=COW  /Applications/Zed.app/Contents/MacOS/zed

... (other threads trimmed) ...

Thread 69 Crashed:: Dispatch queue: livekit.multicast
0   libswiftCore.dylib              0x00007fff69461977 swift::ResolveAsSymbolicReference::operator()(swift::Demangle::SymbolicReferenceKind, swift::Demangle::Directness, int, void const*) + 55
1   libswiftCore.dylib              0x00007fff6947d33d swift::Demangle::Demangler::demangleOperator() + 237
2   libswiftCore.dylib              0x00007fff6947b938 swift::Demangle::Demangler::demangleType(llvm::StringRef, std::__1::function) + 168
3   libswiftCore.dylib              0x00007fff69467156 swift_getTypeByMangledNameImpl(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function const* (unsigned int, unsigned int)>, std::__1::function const* (swift::TargetMetadata const*, unsigned int)>) + 502
4   libswiftCore.dylib              0x00007fff69464aa2 swift::swift_getTypeByMangledName(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function const* (unsigned int, unsigned int)>, std::__1::function const* (swift::TargetMetadata const*, unsigned int)>) + 482
5   libswiftCore.dylib              0x00007fff69464c99 swift_getTypeByMangledNameInContext + 153
6   dev.zed.Zed                     0x0000000107c99a81 __swift_instantiateConcreteTypeFromMangledName + 49
7   dev.zed.Zed                     0x0000000107cbb7be specialized Room.engine(_:didMutate:oldState:) + 1054
8   dev.zed.Zed                     0x0000000107cb5e9d partial apply for closure #1 in closure #1 in Engine.init(connectOptions:) + 29
9   dev.zed.Zed                     0x0000000107ce2b62 $s7LiveKit17MulticastDelegateC6notify5label_ySSycSg_yxctFyyYbcfU_AA06EngineD0_p_Tg5Tm + 930
10  dev.zed.Zed                     0x0000000107ce67da $s7LiveKit17MulticastDelegateC6notify5label_ySSycSg_yxctFyyYbcfU_AA012SignalClientD0_p_Tg5TATm + 42
11  dev.zed.Zed                     0x0000000107cd15d9 $sIegh_IeyBh_TR + 25
12  libdispatch.dylib               0x00007fff69ad16c4 _dispatch_call_block_and_release + 12
13  libdispatch.dylib               0x00007fff69ad2658 _dispatch_client_callout + 8
14  libdispatch.dylib               0x00007fff69ad7c44 _dispatch_lane_serial_drain + 597
15  libdispatch.dylib               0x00007fff69ad85d6 _dispatch_lane_invoke + 363
16  libdispatch.dylib               0x00007fff69ae1c09 _dispatch_workloop_worker_thread + 596
17  libsystem_pthread.dylib         0x00007fff69d30a3d _pthread_wqthread + 290
18  libsystem_pthread.dylib         0x00007fff69d2fb77 start_wqthread + 15

... (other threads trimmed) ...

Thread 69 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000001  rbx: 0x0000700005315a18  rcx: 0x000000000043b921  rdx: 0x0000000000000000
  rdi: 0x0000700005315a18  rsi: 0x0000000000000000  rbp: 0x00007000053156a0  rsp: 0x0000700005315680
   r8: 0x0000000109e2925f   r9: 0x00007000053163e0  r10: 0x00007ffeec787c80  r11: 0x00007fff694708a0
  r12: 0x00007000053157f0  r13: 0x00007000053163e0  r14: 0x0000000000000001  r15: 0x0000000000000000
  rip: 0x00007fff69461977  rfl: 0x0000000000010246  cr2: 0x0000000107c92900

Logical CPU:     0
Error Code:      0x0100001f
Trap Number:     133

... (binary images trimmed) ...

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 284714
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=809.3M resident=0K(0%) swapped_out_or_unallocated=809.3M(100%)
Writable regions: Total=1.9G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.9G(100%)

                                VIRTUAL   REGION
REGION TYPE                        SIZE    COUNT (non-coalesced)
===========                     =======  =======
Accelerate framework               384K        3
Activity Tracing                   256K        1
CG backing stores                  592K        2
CG image                            52K        9
CoreAnimation                      132K       19
CoreGraphics                         8K        1
CoreImage                           24K        6
CoreUI image data                  420K        8
Foundation                           4K        1
IOKit                             23.3M        3
Image IO                             4K        1
Kernel Alloc Once                    8K        1
MALLOC                             1.3G      265
MALLOC guard page                   32K        7
MALLOC_LARGE (reserved)           10.0M        5         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                        304K       76
Stack                            138.1M       78
Stack Guard                       56.0M        1
VM_ALLOCATE                      152.0G      775
VM_ALLOCATE (reserved)            17.2M       81         reserved VM address space (unallocated)
__DATA                            35.0M      375
__DATA_CONST                      3944K       31
__DATA_DIRTY                        128        1
__FONT_DATA                          4K        1
__LINKEDIT                       428.6M        7
__OBJC_RO                         32.3M        1
__OBJC_RW                         1860K        2
__TEXT                           380.7M      369
__UNICODE                          564K        1
mapped file                        2.3G       37
shared memory                      648K       18
===========                     =======  =======
TOTAL                            157.1G     2187
TOTAL, minus reserved VM space   156.7G     2187