dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 498 forks source link

Pairing Senic Firends of Hue Switch on macOS results in a crash #7531

Closed LoPablo closed 6 months ago

LoPablo commented 8 months ago

Does the issue really belong here?

Is there already an existing issue for this?

Describe the bug

Trying to pair the Senic Switch on macOS results in deconz crashing right the moment the button of the switch is let go.

The last message that is display in the console is /Applications/deCONZ.app/Contents/MacOS/deCONZ is loading libcrypto in an unsafe way

Steps to reproduce the behavior

  1. Start deconz
  2. Start pairing process for Friends of Hue switch
  3. Push Button on Switch
  4. Hold for 10 seconds
  5. let go
  6. crash

Expected behavior

Switch is paired, deconz does not crash

Screenshots

No response

Environment

deCONZ Logs

No response

Additional context

No response

LoPablo commented 8 months ago

Here is the stacktrace from the MacOs Error-Reporter if this helps

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               deCONZ [14599]
Path:                  /Applications/deCONZ.app/Contents/MacOS/deCONZ
Identifier:            de.phoscon.deconz
Version:               2.22.0 (???)
Code Type:             X86-64 (Native)
Parent Process:        zsh [14513]
Responsible:           Terminal [23980]
User ID:               501

Date/Time:             2024-01-20 18:43:09.4139 +0100
OS Version:            macOS 13.4.1 (22F770820d)
Report Version:        12
Anonymous UUID:        7FC14C94-2776-C0FC-D432-5CEACE4527F7

Time Awake Since Boot: 680000 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib              0x7ff8021851f2 __pthread_kill + 10
1   libsystem_pthread.dylib             0x7ff8021bcee6 pthread_kill + 263
2   libsystem_c.dylib                   0x7ff8020e3b45 abort + 123
3   libcrypto.dylib                     0x7ffc06be3aee __report_load.cold.1 + 36
4   libcrypto.dylib                     0x7ffc06be3884 __report_load + 569
5   dyld                                0x7ff801e7c41b invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const::$_0::operator()() const + 175
6   dyld                                0x7ff801ebab6a invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 242
7   dyld                                0x7ff801eaef22 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 577
8   dyld                                0x7ff801e5f0af dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 245
9   dyld                                0x7ff801eae0bf dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 175
10  dyld                                0x7ff801eba72a dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 470
11  dyld                                0x7ff801e7968c dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 220
12  dyld                                0x7ff801e821f4 dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 30
13  dyld                                0x7ff801e7987a dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 178
14  dyld                                0x7ff801e7c48f dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_1::operator()() const + 97
15  dyld                                0x7ff801e79911 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 93
16  dyld                                0x7ff801e963f6 dyld4::APIs::dlopen_from(char const*, int, void*) + 944
17  QtCore                                 0x10ee67ef0 0x10ec76000 + 2039536
18  QtCore                                 0x10ee632cb 0x10ec76000 + 2020043
19  libde_rest_plugin.dylib                0x126391932 GP_DecryptSecurityKey(unsigned int, std::__1::array<unsigned char, 16ul> const&) + 290
20  libde_rest_plugin.dylib                0x126342842 DeRestPluginPrivate::gpDataIndication(deCONZ::GpDataIndication const&) + 1826
21  QtCore                                 0x10eea20d5 0x10ec76000 + 2277589
22  libdeCONZ.1.2.0.dylib                  0x10cc9c2e4 deCONZ::GreenPowerController::gpDataIndication(deCONZ::GpDataIndication const&) + 52
23  libdeCONZ.1.2.0.dylib                  0x10cca5987 deCONZ::GreenPowerController::processIncomingData(QByteArray const&) + 231
24  deCONZ                                 0x10cade0d7 zmMaster::processPacked(zm_command const*) + 2263
25  deCONZ                                 0x10cae2bc2 0x10ca5a000 + 560066
26  deCONZ                                 0x10ca69bda protocol_receive + 282
27  deCONZ                                 0x10cae26c8 SerialCom::readyRead() + 648
28  deCONZ                                 0x10cae22ee 0x10ca5a000 + 557806
29  QtCore                                 0x10ee99b9f QObject::event(QEvent*) + 943
30  QtWidgets                              0x10d4619ea QApplicationPrivate::notify_helper(QObject*, QEvent*) + 266
31  QtWidgets                              0x10d462e11 QApplication::notify(QObject*, QEvent*) + 497
32  QtCore                                 0x10ee6ea34 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 212
33  QtCore                                 0x10ee6fd79 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 809
34  libqcocoa.dylib                        0x10da4b259 0x10da11000 + 238169
35  libqcocoa.dylib                        0x10da4b9c8 0x10da11000 + 240072
36  CoreFoundation                      0x7ff802298f2a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
37  CoreFoundation                      0x7ff802298ecc __CFRunLoopDoSource0 + 157
38  CoreFoundation                      0x7ff802298ca5 __CFRunLoopDoSources0 + 217
39  CoreFoundation                      0x7ff80229792f __CFRunLoopRun + 916
40  CoreFoundation                      0x7ff802296f31 CFRunLoopRunSpecific + 560
41  HIToolbox                           0x7ff80bd12dad RunCurrentEventLoopInMode + 292
42  HIToolbox                           0x7ff80bd12bbe ReceiveNextEventCommon + 657
43  HIToolbox                           0x7ff80bd12918 _BlockUntilNextEventMatchingListInModeWithFilter + 64
44  AppKit                              0x7ff80532b5d0 _DPSNextEvent + 858
45  AppKit                              0x7ff80532a47a -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1214
46  AppKit                              0x7ff80531cae8 -[NSApplication run] + 586
47  libqcocoa.dylib                        0x10da4a62f 0x10da11000 + 235055
48  QtCore                                 0x10ee6aacf QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
49  QtCore                                 0x10ee6f042 QCoreApplication::exec() + 130
50  deCONZ                                 0x10ca720ed main + 5629
51  dyld                                0x7ff801e6341f start + 1903

Thread 1:
0   libsystem_kernel.dylib              0x7ff802180fbe __semwait_signal + 10
1   libsystem_c.dylib                   0x7ff802073585 nanosleep + 196
2   libdeCONZ.1.2.0.dylib                  0x10ccc996b U_thread_msleep + 75
3   deCONZ                                 0x10ca6533f 0x10ca5a000 + 45887
4   libdeCONZ.1.2.0.dylib                  0x10ccc98ce thread_func_wrapper + 14
5   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
6   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 2:: com.apple.CFSocket.private
0   libsystem_kernel.dylib              0x7ff802187282 __select + 10
1   CoreFoundation                      0x7ff8022c0edf __CFSocketManager + 643
2   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
3   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 3:: Qt bearer thread
0   libsystem_kernel.dylib              0x7ff80218529e poll + 10
1   QtCore                                 0x10eed101a qt_safe_poll(pollfd*, unsigned int, timespec const*) + 90
2   QtCore                                 0x10eed2a21 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 849
3   QtCore                                 0x10ee6aacf QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
4   QtCore                                 0x10ec97603 QThread::exec() + 131
5   QtCore                                 0x10ec98619 0x10ec76000 + 140825
6   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
7   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 4:: com.apple.NSEventThread
0   libsystem_kernel.dylib              0x7ff80217e5b2 mach_msg2_trap + 10
1   libsystem_kernel.dylib              0x7ff80218c72d mach_msg2_internal + 78
2   libsystem_kernel.dylib              0x7ff8021855e4 mach_msg_overwrite + 692
3   libsystem_kernel.dylib              0x7ff80217e89a mach_msg + 19
4   CoreFoundation                      0x7ff80229906f __CFRunLoopServiceMachPort + 145
5   CoreFoundation                      0x7ff802297af0 __CFRunLoopRun + 1365
6   CoreFoundation                      0x7ff802296f31 CFRunLoopRunSpecific + 560
7   AppKit                              0x7ff80548b789 _NSEventThread + 132
8   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
9   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 5:
0   libsystem_kernel.dylib              0x7ff802180fbe __semwait_signal + 10
1   libsystem_c.dylib                   0x7ff802073585 nanosleep + 196
2   libc++.1.dylib                      0x7ff8021065b4 std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l>> const&) + 73
3   deCONZ                                 0x10cae325c 0x10ca5a000 + 561756
4   deCONZ                                 0x10cae337c 0x10ca5a000 + 562044
5   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
6   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 6:: QNetworkAccessManager thread
0   libsystem_kernel.dylib              0x7ff80218529e poll + 10
1   QtCore                                 0x10eed1220 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 608
2   QtCore                                 0x10eed2a21 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 849
3   QtCore                                 0x10ee6aacf QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
4   QtCore                                 0x10ec97603 QThread::exec() + 131
5   QtCore                                 0x10ec98619 0x10ec76000 + 140825
6   libsystem_pthread.dylib             0x7ff8021bd1d3 _pthread_start + 125
7   libsystem_pthread.dylib             0x7ff8021b8bd3 thread_start + 15

Thread 7:
0   libsystem_pthread.dylib             0x7ff8021b8bb0 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007ff845899640  rcx: 0x00007ff7b34a0fb8  rdx: 0x0000000000000000
  rdi: 0x0000000000000103  rsi: 0x0000000000000006  rbp: 0x00007ff7b34a0fe0  rsp: 0x00007ff7b34a0fb8
   r8: 0x00007ff8458a0d18   r9: 0x0000000000000000  r10: 0x0000000000000000  r11: 0x0000000000000246
  r12: 0x0000000000000103  r13: 0x00007ff7b34a10d0  r14: 0x0000000000000006  r15: 0x0000000000000016
  rip: 0x00007ff8021851f2  rfl: 0x0000000000000246  cr2: 0x00007ff843b245b8

Logical CPU:     0
Error Code:      0x02000
LoPablo commented 8 months ago

So this seems to be a problem in green_power.ccp which tried to load libcrypt. I am currently trying to specify the path to libcrypt and debug the issue but I am currently unable to get deconz to recognise my compiled plugin.dylib.

manup commented 7 months ago

Uff that's a new insight. Not sure yet how to handle this but perhaps simplest way might be to just include the library within the app bundle, same as it is done on Windows.

https://stackoverflow.com/questions/67025761/macos-big-sur-dlopen-usr-lib-libssl-dylib-crashes-with-program-is-loading

github-actions[bot] commented 7 months ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] commented 6 months ago

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

LoPablo commented 6 months ago

This has not been fixed yet. Please reopen.

manup commented 6 months ago

OpenSSL on macOS is now fixed via v2.26.2-beta, closing for now.

LoPablo commented 6 months ago

Can confirm that pairing a switch now works in v2.26.2-beta