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

Electron crash on exit (Segmentation fault, MacOS) #6609

Closed
Friend-LGA opened this issue Apr 12, 2024 · 5 comments
Closed

Electron crash on exit (Segmentation fault, MacOS) #6609

Friend-LGA opened this issue Apr 12, 2024 · 5 comments

Comments

@Friend-LGA
Copy link

Friend-LGA commented Apr 12, 2024

How frequently does the bug occur?

Always

Description

Crash is happening every time Electron app is closed.

  • Happens only on production builds (using "quasar" with "electron-packager")
  • Crash report mentions realm::util::Logger
  • Electron nodeIntegration is disabled and RealmDB is created and used only in the main process (not in the renderer)
  • If all imports of RealmDB commented-out, then crash is not happening, so it must be RealmDB causing the crash
  • Database path is in the userData folder (Electron.app.getPath("userData"))
package.json
{
  "scripts": {
    "dev": "quasar dev -m electron",
    "build": "quasar build -m electron",
  },
  "dependencies": {
    "@quasar/extras": "1.16.9",
    "quasar": "2.15.1",
    "realm": "12.6.2"
  },
  "devDependencies": {
    "@quasar/app-vite": "1.8.0",
    "@quasar/cli": "2.4.0",
    "@types/node": "20.11.1",
    "electron": "29.1.4",
    "electron-packager": "17.1.2",
    "typescript": "5.4.2"
  },
  "engines": {
    "node": "20.11.1"
  },
  "browserslist": [
    "last 1 Electron major versions"
  ],
  "packageManager": "yarn@4.1.1"
}

Stacktrace & log output

MacOS Crash Report
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               UNIAPP [54916]
Path:                  /Users/USER/*/UNIAPP.app/Contents/MacOS/UNIAPP
Identifier:            com.electron.uniapp
Version:               0.0.0-alpha (0.0.0-alpha)
Code Type:             X86-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-04-12 04:01:03.8544 +0300
OS Version:            macOS 13.6.6 (22G630)
Report Version:        12
Bridge OS Version:     3.0 (14Y910)
Anonymous UUID:        222575DC-4AE7-1665-2000-5EE54E39D52A

Sleep/Wake UUID:       CD283BEE-602A-4C16-9AF5-507D96990743

Time Awake Since Boot: 280000 seconds
Time Since Wake:       57891 seconds

System Integrity Protection: enabled

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Codes:       0x0000000000000001, 0x0000000000000008

VM Region Info: 0x8 is not in any region.  Bytes before following region: 140737488244728
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      shared memory            7ffffffe5000-7ffffffe6000 [    4K] r-x/r-x SM=SHM  

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0   Electron Framework            	       0x119a389fd node_api_get_module_file_name + 333
1   Electron Framework            	       0x119a2a23e node::Stop(node::Environment*, node::StopFlags::Flags) + 7886
2   Electron Framework            	       0x119a321d0 napi_delete_reference + 32
3   .com.electron.uniapp.gj7DA0   	       0x160b07f51 std::__1::__shared_ptr_emplace<Napi::FunctionReference, std::__1::allocator<Napi::FunctionReference>>::__on_zero_shared() + 33
4   .com.electron.uniapp.gj7DA0   	       0x160b10e98 realm::util::UniqueFunction<void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>::SpecificImpl<realm::js::node::(anonymous namespace)::Helpers_make_logger(Napi::CallbackInfo const&)::$_9>::~SpecificImpl() + 56
5   .com.electron.uniapp.gj7DA0   	       0x160b10279 std::__1::__function::__func<realm::util::EventLoopDispatcher<void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>, std::__1::allocator<realm::util::EventLoopDispatcher<void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>>, void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>::destroy_deallocate() + 73
6   .com.electron.uniapp.gj7DA0   	       0x160b0fa01 std::__1::__shared_ptr_emplace<realm::js::(anonymous namespace)::Helpers::make_logger(std::__1::function<void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>&&)::MyLogger, std::__1::allocator<realm::js::(anonymous namespace)::Helpers::make_logger(std::__1::function<void (realm::util::Logger::Level, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)>&&)::MyLogger>>::__on_zero_shared() + 33
7   .com.electron.uniapp.gj7DA0   	       0x160c63ea1 std::__1::shared_ptr<realm::util::Logger>::~shared_ptr() + 49
8   libsystem_c.dylib             	    0x7ff802ca6ba1 __cxa_finalize_ranges + 409
9   libsystem_c.dylib             	    0x7ff802ca69bb exit + 35
10  libdyld.dylib                 	    0x7ff802dec8d3 dyld4::LibSystemHelpers::exit(int) const + 11
11  dyld                          	    0x7ff802a7a458 start + 1960

Thread 1:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 2:: ThreadPoolBackgroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e53d node::AsyncResource::get_async_id() const + 10215213
10  Electron Framework            	       0x115b8e4e2 node::AsyncResource::get_async_id() const + 10215122
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 3:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 4:: MemoryInfra
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a592 node::AsyncResource::get_async_id() const + 9936770
6   Electron Framework            	       0x115b07d36 node::AsyncResource::get_async_id() const + 9664294
7   Electron Framework            	       0x115b70679 node::AsyncResource::get_async_id() const + 10092649
8   Electron Framework            	       0x115b30cd9 node::AsyncResource::get_async_id() const + 9832137
9   Electron Framework            	       0x115b95e78 node::AsyncResource::get_async_id() const + 10246248
10  Electron Framework            	       0x115b96017 node::AsyncResource::get_async_id() const + 10246663
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 5:
0   libsystem_kernel.dylib        	    0x7ff802d964ce semaphore_wait_trap + 10
1   Electron Framework            	       0x111fd18d0 uv_sem_wait + 16
2   Electron Framework            	       0x119bd86ac node::SetTracingController(v8::TracingController*) + 126252
3   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
4   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 6:: CrShutdownDetector
0   libsystem_kernel.dylib        	    0x7ff802d96f7e read + 10
1   Electron Framework            	       0x1121eed0b v8::CodeEvent::GetFunctionName() + 33291
2   Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
3   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
4   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 7:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 8:: ThreadPoolSingleThreadSharedForeground1
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5fd node::AsyncResource::get_async_id() const + 10215405
10  Electron Framework            	       0x115b8e4f1 node::AsyncResource::get_async_id() const + 10215137
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 9:: NetworkNotificationThreadMac
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   CoreFoundation                	    0x7ff802eb0fff __CFRunLoopServiceMachPort + 145
5   CoreFoundation                	    0x7ff802eafa80 __CFRunLoopRun + 1365
6   CoreFoundation                	    0x7ff802eaeec1 CFRunLoopRunSpecific + 560
7   Foundation                    	    0x7ff803d3c273 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 216
8   Electron Framework            	       0x115bc02cd node::AsyncResource::get_async_id() const + 10419389
9   Electron Framework            	       0x115bbdf84 node::AsyncResource::get_async_id() const + 10410356
10  Electron Framework            	       0x115b70679 node::AsyncResource::get_async_id() const + 10092649
11  Electron Framework            	       0x115b30cd9 node::AsyncResource::get_async_id() const + 9832137
12  Electron Framework            	       0x115b95e78 node::AsyncResource::get_async_id() const + 10246248
13  Electron Framework            	       0x115b96017 node::AsyncResource::get_async_id() const + 10246663
14  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
15  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
16  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 10:
0   libsystem_pthread.dylib       	    0x7ff802dd0bb0 start_wqthread + 0

Thread 11:: ThreadPoolSingleThreadSharedForegroundBlocking2
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8de41 node::AsyncResource::get_async_id() const + 10213425
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5fd node::AsyncResource::get_async_id() const + 10215405
10  Electron Framework            	       0x115b8e4f1 node::AsyncResource::get_async_id() const + 10215137
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 12:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8de41 node::AsyncResource::get_async_id() const + 10213425
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 13:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8de41 node::AsyncResource::get_async_id() const + 10213425
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 14:: CacheThread_BlockFile
0   libsystem_kernel.dylib        	    0x7ff802d9fdb2 kevent64 + 10
1   Electron Framework            	       0x115bca197 node::AsyncResource::get_async_id() const + 10460039
2   Electron Framework            	       0x115bc9765 node::AsyncResource::get_async_id() const + 10457429
3   Electron Framework            	       0x115b70679 node::AsyncResource::get_async_id() const + 10092649
4   Electron Framework            	       0x115b30cd9 node::AsyncResource::get_async_id() const + 9832137
5   Electron Framework            	       0x115b95e78 node::AsyncResource::get_async_id() const + 10246248
6   Electron Framework            	       0x115b96017 node::AsyncResource::get_async_id() const + 10246663
7   Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
8   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
9   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 15:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   CoreFoundation                	    0x7ff802eb0fff __CFRunLoopServiceMachPort + 145
5   CoreFoundation                	    0x7ff802eafa80 __CFRunLoopRun + 1365
6   CoreFoundation                	    0x7ff802eaeec1 CFRunLoopRunSpecific + 560
7   AppKit                        	    0x7ff8060add65 _NSEventThread + 132
8   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
9   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 16:: ThreadPoolBackgroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8dd86 node::AsyncResource::get_async_id() const + 10213238
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e53d node::AsyncResource::get_async_id() const + 10215213
10  Electron Framework            	       0x115b8e4e2 node::AsyncResource::get_async_id() const + 10215122
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 17:: ThreadPoolSingleThreadSharedBackgroundBlocking3
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8de41 node::AsyncResource::get_async_id() const + 10213425
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e56d node::AsyncResource::get_async_id() const + 10215261
10  Electron Framework            	       0x115b8e50f node::AsyncResource::get_async_id() const + 10215167
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 18:
0   libsystem_kernel.dylib        	    0x7ff802d9908e __psynch_cvwait + 10
1   libsystem_pthread.dylib       	    0x7ff802dd5758 _pthread_cond_wait + 1242
2   Electron Framework            	       0x111fd1a39 uv_cond_wait + 9
3   Electron Framework            	       0x111fc0803 uv_cancel + 739
4   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
5   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 19:
0   libsystem_kernel.dylib        	    0x7ff802d9908e __psynch_cvwait + 10
1   libsystem_pthread.dylib       	    0x7ff802dd5758 _pthread_cond_wait + 1242
2   Electron Framework            	       0x111fd1a39 uv_cond_wait + 9
3   Electron Framework            	       0x111fc0803 uv_cancel + 739
4   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
5   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 20:
0   libsystem_kernel.dylib        	    0x7ff802d9908e __psynch_cvwait + 10
1   libsystem_pthread.dylib       	    0x7ff802dd5758 _pthread_cond_wait + 1242
2   Electron Framework            	       0x111fd1a39 uv_cond_wait + 9
3   Electron Framework            	       0x111fc0803 uv_cancel + 739
4   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
5   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 21:
0   libsystem_kernel.dylib        	    0x7ff802d9908e __psynch_cvwait + 10
1   libsystem_pthread.dylib       	    0x7ff802dd5758 _pthread_cond_wait + 1242
2   Electron Framework            	       0x111fd1a39 uv_cond_wait + 9
3   Electron Framework            	       0x111fc0803 uv_cancel + 739
4   libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
5   libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 22:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib        	    0x7ff802d96552 mach_msg2_trap + 10
1   libsystem_kernel.dylib        	    0x7ff802da46cd mach_msg2_internal + 78
2   libsystem_kernel.dylib        	    0x7ff802d9d584 mach_msg_overwrite + 692
3   libsystem_kernel.dylib        	    0x7ff802d9683a mach_msg + 19
4   Electron Framework            	       0x115bc3450 node::AsyncResource::get_async_id() const + 10432064
5   Electron Framework            	       0x115b4a6aa node::AsyncResource::get_async_id() const + 9937050
6   Electron Framework            	       0x115b8f80d node::AsyncResource::get_async_id() const + 10220029
7   Electron Framework            	       0x115b8de41 node::AsyncResource::get_async_id() const + 10213425
8   Electron Framework            	       0x115b8e85e node::AsyncResource::get_async_id() const + 10216014
9   Electron Framework            	       0x115b8e5cd node::AsyncResource::get_async_id() const + 10215357
10  Electron Framework            	       0x115b8e4b5 node::AsyncResource::get_async_id() const + 10215077
11  Electron Framework            	       0x115baa284 node::AsyncResource::get_async_id() const + 10329204
12  libsystem_pthread.dylib       	    0x7ff802dd51d3 _pthread_start + 125
13  libsystem_pthread.dylib       	    0x7ff802dd0bd3 thread_start + 15

Thread 23:
0   libsystem_pthread.dylib       	    0x7ff802dd0bb0 start_wqthread + 0

Thread 24:
0   libsystem_pthread.dylib       	    0x7ff802dd0bb0 start_wqthread + 0

Thread 25:
0   libsystem_pthread.dylib       	    0x7ff802dd0bb0 start_wqthread + 0


Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00000124017d2300  rcx: 0x0000012400050590  rdx: 0x0000000000000001
  rdi: 0x19c4dd8a68eaa54f  rsi: 0x00000124017d2328  rbp: 0x00007ff7b8163730  rsp: 0x00007ff7b8163710
   r8: 0x0000000000000001   r9: 0x0000000000000007  r10: 0x0000000000000002  r11: 0x0000000000000001
  r12: 0x0000000000000002  r13: 0x00000000000000e0  r14: 0x000001240162eac0  r15: 0x0000000000000000
  rip: 0x0000000119a389fd  rfl: 0x0000000000000202  cr2: 0x0000000000000000
  
Logical CPU:     0
Error Code:      0x020000b8 
Trap Number:     133

Thread 0 instruction stream:
  c1 e8 02 48 21 d0 4c 01-c0 48 89 c2 48 c1 ea 04  ...H!.L..H..H...
  48 01 c2 48 b8 0f 0f 0f-0f 0f 0f 0f 0f 48 21 d0  H..H.........H!.
  49 bb 01 01 01 01 01 01-01 01 4c 0f af d8 49 c1  I.........L...I.
  eb 38 49 83 fb 01 76 15-49 89 f8 4c 39 d7 72 14  .8I...v.I..L9.r.
  48 89 f8 31 d2 49 f7 f2-49 89 d0 eb 07 4d 8d 42  H..1.I..I....M.B
  ff 49 21 f8 55 48 89 e5-53 48 83 ec 18 48 8b 01  .I!.UH..SH...H..
 [4a]8b 04 c0 48 85 c0 74-33 4c 8b 08 4d 85 c9 74  J...H..t3L..M..t	<==
  2b 49 8d 5a ff eb 0e 49-39 71 10 74 35 4d 8b 09  +I.Z...I9q.t5M..
  4d 85 c9 74 17 49 8b 41-08 48 39 f8 74 e9 41 83  M..t.I.A.H9.t.A.
  fb 01 77 0f 48 21 d8 4c-39 c0 74 e1 48 83 c4 18  ..w.H!.L9.t.H...
  5b 5d c3 4c 39 d0 72 ef-31 d2 49 f7 f2 48 89 d0  [].L9.r.1.I..H..
  eb e5 48 8d 5d e0 48 89-df 48 89 ce 4c 89 ca e8  ..H.].H..H..L...

Binary Images:
       0x107d9c000 -        0x107d9dfff com.electron.uniapp (0.0.0-alpha) <4c4c4451-5555-3144-a143-8b2b4c274d1a> /Users/USER/*/UNIAPP.app/Contents/MacOS/UNIAPP
       0x111bda000 -        0x11b26efff com.github.Electron.framework (*) <4c4c4432-5555-3144-a125-a68520c86e72> /Users/USER/*/UNIAPP.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework
       0x107e02000 -        0x107e16fff com.github.Squirrel (1.0) <4c4c44ce-5555-3144-a173-e6869c572b84> /Users/USER/*/UNIAPP.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel
       0x107e7c000 -        0x107ebdfff com.electron.reactive (3.1.0) <4c4c4417-5555-3144-a191-0ea02b95104b> /Users/USER/*/UNIAPP.app/Contents/Frameworks/ReactiveObjC.framework/Versions/A/ReactiveObjC
       0x107e21000 -        0x107e2cfff org.mantle.Mantle (1.0) <4c4c4435-5555-3144-a135-22fda3f553d7> /Users/USER/*/UNIAPP.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle
       0x10814a000 -        0x108380fff libffmpeg.dylib (*) <4c4c44f7-5555-3144-a126-0193eeafb4e0> /Users/USER/*/UNIAPP.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib
       0x160af0000 -        0x1610d7fff .com.electron.uniapp.gj7DA0 (*) <00298261-8237-3df5-a9bd-18e631312a88> /private/var/folders/*/.com.electron.uniapp.gj7DA0
       0x108fe8000 -        0x108ff7fff libobjc-trampolines.dylib (*) <5eaf78f9-49d0-30e2-a516-d53697b7344a> /usr/lib/libobjc-trampolines.dylib
    0x7ff802c7c000 -     0x7ff802d03ff7 libsystem_c.dylib (*) <a720129c-c1cf-3e62-9d76-aa6fa0d31333> /usr/lib/system/libsystem_c.dylib
    0x7ff802ddb000 -     0x7ff802dfeff7 libdyld.dylib (*) <8effa0bc-efb9-3a46-9236-0b998c21f77f> /usr/lib/system/libdyld.dylib
    0x7ff802a74000 -     0x7ff802b0c5ef dyld (*) <022fb827-a638-3286-a672-588c661526e0> /usr/lib/dyld
    0x7ff802d95000 -     0x7ff802dcefff libsystem_kernel.dylib (*) <484971ab-1a24-3d48-9726-4ad56d8e05d3> /usr/lib/system/libsystem_kernel.dylib
    0x7ff802dcf000 -     0x7ff802ddafff libsystem_pthread.dylib (*) <60b15e1f-39ea-33a1-8616-3af57dc1094a> /usr/lib/system/libsystem_pthread.dylib
    0x7ff802e34000 -     0x7ff8032d0fef com.apple.CoreFoundation (6.9) <46af372c-e1f2-33b3-a032-d5ac06f50c80> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7ff803cdd000 -     0x7ff804665ff1 com.apple.Foundation (6.9) <f53fbbed-7574-3180-b2a0-e8235475e636> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    0x7ff805f0f000 -     0x7ff806f17fff com.apple.AppKit (6.9) <1cef1965-5c03-321d-ac43-3383f38267b7> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

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: 0
    thread_create: 0
    thread_set_state: 0

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

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               512K        4 
Activity Tracing                   256K        1 
CG backing stores                 2880K        4 
CG image                            56K        6 
ColorSync                          236K       25 
CoreAnimation                       72K        5 
CoreGraphics                        12K        2 
CoreUI image data                 1104K        8 
Dispatch continuations            64.0M        1 
Foundation                          36K        2 
IOKit                             7940K        1 
Kernel Alloc Once                    8K        1 
MALLOC                            61.2M       30 
MALLOC guard page                   32K        8 
Memory Tag 253                    32.0G     1121 
Memory Tag 255                     1.1T      236 
Memory Tag 255 (reserved)         1104K        3         reserved VM address space (unallocated)
STACK GUARD                       56.1M       26 
Stack                            154.8M       27 
VM_ALLOCATE                        4.0G       15 
__CTF                               824        1 
__DATA                            37.2M      604 
__DATA_CONST                      44.9M      393 
__DATA_DIRTY                      1811K      232 
__FONT_DATA                        2352        1 
__INFO_FILTER                         8        1 
__LINKEDIT                       174.5M        9 
__OBJC_RO                         66.3M        1 
__OBJC_RW                         2013K        2 
__TEXT                           775.0M      626 
dyld private memory                260K        2 
mapped file                      204.6M       33 
shared memory                      800K       20 
===========                     =======  ======= 
TOTAL                              1.1T     3451 
TOTAL, minus reserved VM space     1.1T     3451 
Crash info from terminal
>  ~ /Users/user/Projects/uniapp/dist/electron/Packaged/UNIAPP-darwin-x64/UNIAPP.app/Contents/MacOS/UNIAPP ; exit;
[1]    53176 segmentation fault  
Saving session...completed.
[Process completed]

Can you reproduce the bug?

Always

Reproduction Steps

  1. Open Electron app
  2. Open Realm database in the main process
  3. Close the app
  4. Observe the crash

Realm.open() is enough for crash, nothing fancy

Version

  • Realm 12.6.2
  • Electron 29.1.4
  • Node 20.11.1
  • Yarn 4.1.1

What services are you using?

Local Database only (no sync)

Are you using encryption?

No

Platform OS and version(s)

  • MacOS 13.6.6 (22G630)
Copy link

sync-by-unito bot commented Apr 12, 2024

➤ PM Bot commented:

Jira ticket: RJS-2800

@kneth
Copy link
Contributor

kneth commented Apr 12, 2024

@Friend-LGA In the next version, we will introduce a static method Realm.shutdown() which you can call when closing the app. It will prevent the crash.

@sync-by-unito sync-by-unito bot closed this as completed Apr 12, 2024
@Friend-LGA
Copy link
Author

Confirmed, after adding Realm.shutdown() the issue is fixed. Thanks!

@GitMurf
Copy link

GitMurf commented Apr 25, 2024

@Friend-LGA how did you test Realm.shutdown()? Which version did it land in? Thanks! cc @kneth

@Friend-LGA
Copy link
Author

@GitMurf well, just added Realm.shutdown() on before exit the app, and the issue is gone, as simple as that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants