theengs / gateway

Multi platform Multi devices BLE Bluetooth to MQTT gateway leveraging Theengs Decoder
https://gateway.theengs.io
GNU General Public License v3.0
111 stars 31 forks source link

Segfault error 4 in libc.so.6 #124

Open orzechszek opened 1 year ago

orzechszek commented 1 year ago

I've noticed recently,, that I'm getting segfault quite often

Apr 6 11:07:17 openhab kernel: [ 2958.011031] python3[13034]: segfault at 0 ip 00007f332d7753bd sp 00007f332adb8df8 error 4 in libc.so.6 [7f332d622000+179000] Apr 6 11:07:17 openhab kernel: [ 2958.011077] Code: e1 c5 f8 77 c3 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 89 f8 48 89 fa c5 f9 ef c0 25 ff 0f 00 00 3d e0 0f 00 00 0f 87 33 01 00 00 <c5> fd 74 0f c5 fd d7 c1 85 c0 74 57 f3 0f bc c0 c5 f8 77 c3 66 66

Coredump in attachment.

core.python3.0.d17642bc1c99473cad951ae65472ba6b.9616.1680771946000000.zst.zip

Environment Output of python -m TheengsGateway.diagnose

Theengs Gateway Diagnostics

Package Versions

Name Value
Theengs Gateway 0.9.0
Theengs Decoder 1.3.7
Bleak 0.19.5
Bluetooth Clocks 0.1.2
Bluetooth Numbers 1.1.0
Paho MQTT 1.6.1
Bluetooth Adapters 0.15.3

Python

Name Value
Version 3.10.7
Implementation CPython
Compiler GCC 12.2.0
Executable /usr/bin/python3

Operating System

Name Value
System Linux
Release 5.19.0-38-generic
Version #39-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 17:33:16 UTC 2023
Machine type x86_64
Distribution Ubuntu 22.10

Configuration

{
    "adapter": "",
    "ble_scan_time": 10,
    "ble_time_between_scans": 2,
    "discovery": 1,
    "discovery_device_name": "TheengsGateway",
    "discovery_filter": [
        "IBEACON",
        "GAEN",
        "MS-CDP",
    ],
    "discovery_topic": "homeassistant/sensor",
    "hass_discovery": 1,
    "host": "192.168.XX.X",
    "log_level": "DEBUG",
    "lwt_topic": "home/TheengsGateway/LWT",
    "pass": "***",
    "port": 1883,
    "presence": 0,
    "presence_topic": "home/TheengsGateway/presence",
    "publish_all": 1,
    "publish_topic": "home/TheengsGateway/BTtoMQTT",
    "scanning_mode": "active",
    "subscribe_topic": "home/TheengsGateway/+",
    "time_format": 0,
    "time_sync": [],
    "user": "***"
}

Bluetooth adapters

Default adapter: hci0

hci0

Name Value
address D0:7E:35:XX:XX:XX
sw_version openhab
hw_version usb:v1D6Bp0246d0541
passive_scan False
manufacturer Intel Corporate
product 07dc
vendor_id 8087
product_id 07dc
koenvervloesem commented 1 year ago

Can you try to use this with the lowest supported version of Theengs Decoder? pip install TheengsDecoder==1.3.0.

koenvervloesem commented 1 year ago

Wait, we didn't have a TheengsDecoder package then, ignore that suggestion πŸ™‚

orzechszek commented 1 year ago

Already installed TheengsDecoder version 1.3.0 and under testing πŸ™‚ Should I revert changes?

koenvervloesem commented 1 year ago

No I'm curious now that it's under testing whether something in a recent Decoder release leads to your issue.

orzechszek commented 1 year ago

Error occurs again with version 1.3.0:

Apr 7 10:39:10 openhab kernel: [87680.127489] python3[86690]: segfault at 0 ip 00007f2fb3f753bd sp 00007f2fb15e3ed8 error 4 in libc.so.6[7f2fb3e22000+179000] Apr 7 10:39:10 openhab kernel: [87680.127538] Code: e1 c5 f8 77 c3 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 89 f8 48 89 fa c5 f9 ef c0 25 ff 0f 00 00 3d e0 0f 00 00 0f 87 33 01 00 00 <c5> fd 74 0f c5 fd d7 c1 85 c0 74 57 f3 0f bc c0 c5 f8 77 c3 66 66

koenvervloesem commented 1 year ago

Ok, I think you'll need to investigate the core dump. Are you able to do that? You need to install the python3-dbg package on the same machine and then run gdb python3-dbg core.python3.0.d17642bc1c99473cad951ae65472ba6b.9616.1680771946000000. I'm not that experienced with it, but I hope it shows us more information.

orzechszek commented 1 year ago

Unfortunately I'm not a programmer :/. Maybe somebody else can help ?

koenvervloesem commented 1 year ago

Do you see whether this segfault always occurs after decoding a specific Bluetooth device? Or is it random? What's the latest decoding you see as an MQTT message or in the Gateway's console output before it segfaults?

koenvervloesem commented 1 year ago

By the way, can you try running with log_level set to INFO instead of DEBUG to see whether that makes a difference?

orzechszek commented 1 year ago

In logs I see that segfault appears after these two:

`DEBUG:BLEGateway:D2:64:5C:XX:XX:XX:AdvertisementData(local_name='RDL52832', manufacturer_data= {76: b'\x02\x15\xfd\xa5\x06\x93\xa4\xe2O\xb1\xaf\xcf\xc6\xeb\x07dx%\x00\x01\x00\x02\xd8'}, rssi=-85)

DEBUG:BLEGateway:D9:1C:BC:XX:XX:XX:AdvertisementData(local_name='RDL52832', manufacturer_dat a={76: b'\x02\x15\xfd\xa5\x06\x93\xa4\xe2O\xb1\xaf\xcf\xc6\xeb\x07dx%\x00\x01\x00\x02\xd8'}, rssi=-74)`

It seems it happens when beacon appears in a system, but randomly and it must be gone for longer time, because when I hide it for a while and shows again, it works properly.

I'll try with INFO level.

koenvervloesem commented 1 year ago

Can you try to disable the RDL52832 devices, e.g. by removing their battery? If the gateway doesn't crash after this, then the segfault is probably triggered by the RDL52832 decoder.

orzechszek commented 1 year ago

This time it was working quite longer without RDL in a system, but even RDL it's a cause, I think it would be better to ask somebody for analyze to prevent such cases. This beacon is a great solution for presence detection.

DigiH commented 1 year ago

@orzechszek

Could you try with the new Theengs Gateway release v1.0.0, to see if it changes anything for you?

Thanks

orzechszek commented 1 year ago

@DigiH issue still exists 😒 , coredump attached if needed. core.python3.0.d17642bc1c99473cad951ae65472ba6b.2977489.1681919117000000.zip

orzechszek commented 1 year ago

Should I provide anything else to help ?

Edit: @DigiH , I've noticed that crash happened not only with mentioned beacons. Can you test run configuration: python3 -m TheengsGateway -H "192.168.X.X" -ll "INFO" -tb 2 -sd 10

DigiH commented 1 year ago

I just read that the RDL52832 might be causing your issue, so I implemented the above change on the Decoder side. Unfortunately I don't have enough knowledge on the Gateway Python side to test and see what your issue might still be :(

orzechszek commented 1 year ago

Details from dump if it can helps:

`#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76

1 0x00007f95889a9a5b in TheengsDecoder::data_index_is_valid(char const*, unsigned long, unsigned long) ()

from /usr/local/lib/python3.10/dist-packages/TheengsDecoder/_decoder.cpython-310-x86_64-linux-gnu.so

2 0x00007f95889ae449 in TheengsDecoder::decodeBLEJson(ArduinoJson6183_71::ObjectRef&) ()

from /usr/local/lib/python3.10/dist-packages/TheengsDecoder/_decoder.cpython-310-x86_64-linux-gnu.so

3 0x00007f95889a6f38 in decode_BLE(_object, _object) ()

from /usr/local/lib/python3.10/dist-packages/TheengsDecoder/_decoder.cpython-310-x86_64-linux-gnu.so

4 0x000056507049d798 in cfunction_call (func=<built-in method decodeBLE of module object at remote 0x7f9587ceade0>,

args=<optimized out>, kwargs=<optimized out>) at ../Objects/methodobject.c:552

5 0x0000565070494f5b in _PyObject_MakeTpCall (tstate=0x565071e55cb0,

callable=<built-in method decodeBLE of module object at remote 0x7f9587ceade0>, args=<optimized out>, nargs=1, keywords=0x0)
at ../Objects/call.c:215

6 0x000056507048e02b in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=,

callable=<optimized out>, tstate=<optimized out>) at ../Include/cpython/abstract.h:112

7 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=, callable=,

tstate=<optimized out>) at ../Include/cpython/abstract.h:99

8 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=, callable=)

at ../Include/cpython/abstract.h:123

9 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e4850, tstate=)

at ../Python/ceval.c:5891

10 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4213

11 0x00005650704aa6d4 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f958000a9b0, for file /usr/local/lib/python3.10/dist-packages/TheengsGateway/ble_gateway.py, line 320, in detection_callback (self=<Gateway(broker='192.168.X.X', port=1883, username='', password='', adapter='', scanning_mode='active', stopped=False, clock_updates={}, discovery=0, scan_time=12, time_between_scans=3, sub_topic='home/TheengsGateway/+', pub_topic='home/TheengsGateway/BTtoMQTT', lwt_topic='home/TheengsGateway/LWT', presence_topic='home/TheengsGateway/presence', presence=0, publish_all=1, time_sync=[], time_format=False, client=<Client(_transport='tcp', _protocol=4, _userdata=None, _sock=<socket at remote 0x7f9587149de0>, _sockpairR=None, _sockpairW=None, _keepalive=60, _connect_timeout=<float at remote 0x7f95868b62d0>, _client_mode=0, _clean_session=True, _client_id=b'', _username=b'', _password=b'', _in_packet={'command': 0, 'have_remaining': 0, 'remaining_count': [], 'remaining_mult': 1, 'remaining_length': 0, 'packet': <bytearray at remote 0x7f95879afaf0>, 'to_process': 0, 'pos': 0}...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

12 _PyEval_Vector (kwnames=, argcount=, args=0x7f958000a948, locals=0x0, con=0x7f95871359a0,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

13 _PyFunction_Vectorcall (kwnames=, nargsf=, stack=0x7f958000a948,

func=<function at remote 0x7f9587135990>) at ../Objects/call.c:342

14 _PyObject_VectorcallTstate (kwnames=, nargsf=, args=0x7f958000a948,

callable=<function at remote 0x7f9587135990>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

15 method_vectorcall (method=, args=0x7f958000a950, nargsf=, kwnames=)

at ../Objects/classobject.c:53

16 0x000056507048dc9a in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f958000a950,

callable=<method at remote 0x7f958713ef00>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

17 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f958000a950, callable=<method at remote 0x7f958713ef00>)

at ../Include/cpython/abstract.h:123

18 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e4a80, tstate=)

at ../Python/ceval.c:5891

19 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4181

20 0x00005650704aa6d4 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f958000a790, for file /usr/local/lib/python3.10/dist-packages/bleak/backends/bluezdbus/scanner.py, line 279, in _handle_advertising_data (self=<BleakScannerBlueZDBus(_callback=<method at remote 0x7f958713ef00>, _service_uuids=None, seen_devices={'D9:1C:BC:0C:XX:XX': (<BLEDevice(address='D9:1C:BC:0C:XX:XX', name='RDL52832', details={'path': '/org/bluez/hci0/dev_D9_1C_BC_0C_XX_XX', 'props': {'Address': 'D9:1C:BC:0C:XX:XX', 'AddressType': 'random', 'Name': 'RDL52832', 'Alias': 'RDL52832', 'Paired': False, 'Bonded': False, 'Trusted': False, 'Blocked': False, 'LegacyPairing': False, 'Connected': False, 'UUIDs': [], 'Adapter': '/org/bluez/hci0', 'ManufacturerData': {76: <bytearray at remote 0x7f958715f730>}, 'ServicesResolved': False, 'RSSI': -65, 'ServiceData': {'00001803-0000-1000-8000-00805f9b34fb': <bytearray at remote 0x7f958715f830>}}}, rssi=-65, metadata={'uuids': [...], 'manufacturer_data': {76: b'\x02\x15\xfd\xa5\x06\x93\xa4\xe2O\xb1\xaf\xcf\xc6\xeb\x07dx%\x00\x01\x00\x02\xd8'}}) at remote 0x7f958...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

21 _PyEval_Vector (kwnames=, argcount=, args=0x7f9587152278, locals=0x0, con=0x7f9587135400,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

22 _PyFunction_Vectorcall (kwnames=, nargsf=, stack=0x7f9587152278,

func=<function at remote 0x7f95871353f0>) at ../Objects/call.c:342

23 _PyObject_VectorcallTstate (kwnames=, nargsf=, args=0x7f9587152278,

callable=<function at remote 0x7f95871353f0>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

24 method_vectorcall (method=, args=0x7f9587152280, nargsf=, kwnames=)

at ../Objects/classobject.c:53

25 0x00005650704885d0 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=,

callable=<method at remote 0x7f958713f8c0>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

26 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=, callable=<method at remote 0x7f958713f8c0>)

at ../Include/cpython/abstract.h:123

27 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e4cb0, tstate=)

at ../Python/ceval.c:5891

28 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4213

29 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f95871520e0, for file /usr/local/lib/python3.10/dist-packages/bleak/backends/bluezdbus/manager.py, line 878, in _run_advertisement_callbacks (self=<BlueZManager(_bus=<MessageBus at remote 0x7f958711a500>, _bus_lock=<Lock(_waiters=None, _locked=False) at remote 0x7f958712a7d0>, _properties={'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'D0:7E:35:67:18:43', 'AddressType': 'public', 'Name': 'openhab', 'Alias': 'openhab', 'Class': 268, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': True, 'UUIDs': ['00001801-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

30 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f9587135010,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

31 _PyFunction_Vectorcall (func=<function at remote 0x7f9587135000>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

32 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f9580007520,

callable=<function at remote 0x7f9587135000>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

33 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f9580007520, callable=<function at remote 0x7f9587135000>)

at ../Include/cpython/abstract.h:123

34 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e4e80, tstate=)

at ../Python/ceval.c:5891

35 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

36 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9580007300, for file /usr/local/lib/python3.10/dist-packages/bleak/backends/bluezdbus/manager.py, line 764, in _parse_msg (self=<BlueZManager(_bus=<MessageBus at remote 0x7f958711a500>, _bus_lock=<Lock(_waiters=None, _locked=False) at remote 0x7f958712a7d0>, _properties={'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'D0:7E:35:67:XX:XX', 'AddressType': 'public', 'Name': 'openhab', 'Alias': 'openhab', 'Class': 268, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': True, 'UUIDs': ['00001801-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0541', 'Roles'...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

37 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f9587134f80,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

38 _PyFunction_Vectorcall (func=<function at remote 0x7f9587134f70>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

39 0x00007f958783204e in __Pyx_PyObject_Call (kw=0x0,

arg=(<BlueZManager(_bus=<MessageBus at remote 0x7f958711a500>, _bus_lock=<Lock(_waiters=None, _locked=False) at remote 0x7f958712a7d0>, _properties={'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'D0:7E:35:67:XX:XX', 'AddressType': 'public', 'Name': 'openhab', 'Alias': 'openhab', 'Class': 268, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': True, 'UUIDs': ['00001801-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0541', 'Roles': ['central', 'peripheral']}, 'org.freedesktop.DBus.Properties': {}, 'org.bluez.GattManager1': {}, 'org.bluez.Media1': {}, 'org.bluez.Net...(truncated), func=<function at remote 0x7f9587134f70>)
at src/dbus_fast/message_bus.c:37223

40 __Pyx_PyObject_Call2Args (function=<function at remote 0x7f9587134f70>,

arg1=<BlueZManager(_bus=<MessageBus at remote 0x7f958711a500>, _bus_lock=<Lock(_waiters=None, _locked=False) at remote 0x7f958712a7d0>, _properties={'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'D0:7E:35:67:XX:XX', 'AddressType': 'public', 'Name': 'openhab', 'Alias': 'openhab', 'Class': 268, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': True, 'UUIDs': ['00001801-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0541', 'Roles': ['central', 'peripheral']}, 'org.freedesktop.DBus.Properties': {}, 'org.bluez.GattManager1': {}, 'org.bluez.Media1': {}, 'org.bluez.Netw...(truncated), arg2=<optimized out>)
at src/dbus_fast/message_bus.c:37256

41 0x00007f958786e93a in pyx_f_9dbus_fast_11message_bus_14BaseMessageBusprocess_message (

__pyx_v_self=__pyx_v_self@entry=0x7f958711a500, __pyx_v_msg=__pyx_v_msg@entry=0x7f958798d260,
__pyx_skip_dispatch=__pyx_skip_dispatch@entry=1) at src/dbus_fast/message_bus.c:16166

42 0x00007f9587873a73 in __pyx_pf_9dbus_fast_11message_bus_14BaseMessageBus_44_process_message (__pyx_v_msg=0x7f958798d260,

__pyx_v_self=0x7f958711a500) at src/dbus_fast/message_bus.c:17806

43 __pyx_pw_9dbus_fast_11message_bus_14BaseMessageBus_45_process_message (__pyx_v_self=<MessageBus at remote 0x7f958711a500>,

__pyx_v_msg=<dbus_fast.message.Message at remote 0x7f958798d260>) at src/dbus_fast/message_bus.c:17786

44 0x00007f9587c3b719 in __Pyx_CyFunction_CallMethod (kw=0x0, arg=(<dbus_fast.message.Message at remote 0x7f958798d260>,),

self=<MessageBus at remote 0x7f958711a500>, func=<cython_function_or_method at remote 0x7f9587914a00>)
at src/dbus_fast/message.c:10739

45 __Pyx_CyFunction_CallAsMethod (kw=0x0, args=<unknown at remote 0x7f9587873a40>,

func=<cython_function_or_method at remote 0x7f9587914a00>) at src/dbus_fast/message.c:10788

46 __Pyx_CyFunction_CallAsMethod (func=func@entry=<cython_function_or_method at remote 0x7f9587914a00>,

args=args@entry=(<MessageBus at remote 0x7f958711a500>, <dbus_fast.message.Message at remote 0x7f958798d260>), kw=kw@entry=0x0)
at src/dbus_fast/message.c:10764

47 0x00007f9588661ffe in __Pyx_PyObject_Call (kw=0x0,

arg=(<MessageBus at remote 0x7f958711a500>, <dbus_fast.message.Message at remote 0x7f958798d260>),
func=<cython_function_or_method at remote 0x7f9587914a00>) at src/dbus_fast/aio/message_reader.c:4150

48 __Pyx_PyObject_Call2Args (function=<cython_function_or_method at remote 0x7f9587914a00>,

arg1=<MessageBus at remote 0x7f958711a500>, arg2=arg2@entry=<dbus_fast.message.Message at remote 0x7f958798d260>)
at src/dbus_fast/aio/message_reader.c:4183

49 0x00007f9588664688 in pyx_pf_9dbus_fast_3aio_14message_reader_20build_message_reader__message_reader (pyx_self=)

at src/dbus_fast/aio/message_reader.c:2213

50 pyx_pw_9dbus_fast_3aio_14message_reader_20build_message_reader_1_message_reader (pyx_self=,

unused=<optimized out>) at src/dbus_fast/aio/message_reader.c:2059

51 0x0000565070494f5b in _PyObject_MakeTpCall (tstate=0x565071e55cb0, callable=<cython_function_or_method at remote 0x7f9587988930>,

args=<optimized out>, nargs=0, keywords=0x0) at ../Objects/call.c:215

52 0x00005650706218c2 in context_run (self=0x7f958713e4c0, args=0x7f9588bd0688, nargs=1, kwnames=0x0) at ../Python/context.c:665

53 0x00005650704927fb in cfunction_vectorcall_FASTCALL_KEYWORDS (

func=<built-in method run of _contextvars.Context object at remote 0x7f958713e4c0>, args=0x7f9588bd0688, nargsf=<optimized out>,
kwnames=0x0) at ../Objects/methodobject.c:446

54 0x000056507048ec78 in do_call_core (kwdict=0x0, callargs=(<cython_function_or_method at remote 0x7f9587988930>,),

func=<built-in method run of _contextvars.Context object at remote 0x7f958713e4c0>, trace_info=0x7f95867e5410,
tstate=<optimized out>) at ../Python/ceval.c:5915

55 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4277

56 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9587c73c50, for file /usr/lib/python3.10/asyncio/events.py, line 80, in _run (self=<Handle at remote 0x7f958714a140>),
tstate=0x565071e55cb0) at ../Include/internal/pycore_ceval.h:46

57 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f95887669f0,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

58 _PyFunction_Vectorcall (func=<function at remote 0x7f95887669e0>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

59 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f9580000d80,

callable=<function at remote 0x7f95887669e0>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

60 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f9580000d80, callable=<function at remote 0x7f95887669e0>)

at ../Include/cpython/abstract.h:123

61 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e55e0, tstate=)

at ../Python/ceval.c:5891

62 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

63 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9580000bb0, for file /usr/lib/python3.10/asyncio/base_events.py, line 1896, in _run_once (self=<_UnixSelectorEventLoop(_timer_cancelled_count=0, _closed=False, _stopping=False, _ready=<collections.deque at remote 0x7f958799fe20>, _scheduled=[<TimerHandle at remote 0x7f95879821f0>], _default_executor=None, _internal_fds=1, _thread_id=140280183285440, _clock_resolution=<float at remote 0x7f9587d2e5d0>, _exception_handler=None, _debug=False, slow_callback_duration=<float at remote 0x7f9588ffe7f0>, _current_handle=None, _task_factory=None, _coroutine_origin_tracking_enabled=False, _coroutine_origin_tracking_saved_depth=None, _asyncgens=<WeakSet(data=set(), _remove=<function at remote 0x7f9587135bd0>, _pending_removals=[], _iterating=set()) at remote 0x7f958712b190>, _asyncgens_shutdown_called=False, _executor_shutdown_called=False, _selector=<EpollSelector(_fd_to_key={4: <SelectorKey at remote 0x7f9587127ba0>, 7: <SelectorKey at remote 0x7f9587156a20>}, _map=<_SelectorMapping(_selector=<...>) at remote ...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

64 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f958815af90,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

65 _PyFunction_Vectorcall (func=<function at remote 0x7f958815af80>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

66 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f95879aa258,

callable=<function at remote 0x7f958815af80>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

67 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f95879aa258, callable=<function at remote 0x7f958815af80>)

at ../Include/cpython/abstract.h:123

68 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e57b0, tstate=)

at ../Python/ceval.c:5891

69 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

70 0x00005650704aa927 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f95879aa0e0, for file /usr/lib/python3.10/asyncio/base_events.py, line 600, in run_forever (self=<_UnixSelectorEventLoop(_timer_cancelled_count=0, _closed=False, _stopping=False, _ready=<collections.deque at remote 0x7f958799fe20>, _scheduled=[<TimerHandle at remote 0x7f95879821f0>], _default_executor=None, _internal_fds=1, _thread_id=140280183285440, _clock_resolution=<float at remote 0x7f9587d2e5d0>, _exception_handler=None, _debug=False, slow_callback_duration=<float at remote 0x7f9588ffe7f0>, _current_handle=None, _task_factory=None, _coroutine_origin_tracking_enabled=False, _coroutine_origin_tracking_saved_depth=None, _asyncgens=<WeakSet(data=set(), _remove=<function at remote 0x7f9587135bd0>, _pending_removals=[], _iterating=set()) at remote 0x7f958712b190>, _asyncgens_shutdown_called=False, _executor_shutdown_called=False, _selector=<EpollSelector(_fd_to_key={4: <SelectorKey at remote 0x7f9587127ba0>, 7: <SelectorKey at remote 0x7f9587156a20>}, _map=<_SelectorMapping(_selector=<...>) at remote...(truncated), tstate=0x565071e55cb0)
at ../Include/internal/pycore_ceval.h:46

71 _PyEval_Vector (kwnames=0x0, argcount=1, args=0x7f95867e5858, locals=0x0, con=0x7f9588159490, tstate=0x565071e55cb0)

at ../Python/ceval.c:5065

72 _PyFunction_Vectorcall (kwnames=0x0, nargsf=1, stack=0x7f95867e5858, func=<function at remote 0x7f9588159480>)

at ../Objects/call.c:342

73 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=1, args=0x7f95867e5858, callable=<function at remote 0x7f9588159480>,

tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

74 method_vectorcall (method=, args=, nargsf=, kwnames=)

at ../Objects/classobject.c:61

75 0x000056507048a711 in do_call_core (kwdict={}, callargs=(), func=<method at remote 0x7f95868e1680>, trace_info=0x7f95867e59e0,

tstate=<optimized out>) at ../Python/ceval.c:5943

76 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4277

77 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9587985380, for file /usr/lib/python3.10/threading.py, line 953, in run (self=<Thread(_target=<method at remote 0x7f95868e1680>, _name='Thread-1 (run_forever)', _args=(), _kwargs={}, _daemonic=True, _ident=140280183285440, _native_id=204974, _tstate_lock=<_thread.lock at remote 0x7f958713e500>, _started=<Event(_cond=<Condition(_lock=<_thread.lock at remote 0x7f958713e480>, acquire=<built-in method acquire of _thread.lock object at remote 0x7f958713e480>, release=<built-in method release of _thread.lock object at remote 0x7f958713e480>, _waiters=<collections.deque at remote 0x7f958799ffa0>) at remote 0x7f958712b3a0>, _flag=True) at remote 0x7f958712b370>, _is_stopped=False, _initialized=True, _stderr=<_io.TextIOWrapper at remote 0x7f9588f71220>, _invoke_excepthook=<function at remote 0x7f9587135cf0>) at remote 0x7f958712b340>), tstate=0x565071e55cb0) at ../Include/internal/pycore_ceval.h:46

78 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f95888e5eb0,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

79 _PyFunction_Vectorcall (func=<function at remote 0x7f95888e5ea0>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

80 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f9587c73600,

callable=<function at remote 0x7f95888e5ea0>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

81 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f9587c73600, callable=<function at remote 0x7f95888e5ea0>)

at ../Include/cpython/abstract.h:123

82 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e5bb0, tstate=)

at ../Python/ceval.c:5891

83 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

84 0x000056507049dff9 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9587c73490, for file /usr/lib/python3.10/threading.py, line 1016, in _bootstrap_inner (self=<Thread(_target=<method at remote 0x7f95868e1680>, _name='Thread-1 (run_forever)', _args=(), _kwargs={}, _daemonic=True, _ident=140280183285440, _native_id=204974, _tstate_lock=<_thread.lock at remote 0x7f958713e500>, _started=<Event(_cond=<Condition(_lock=<_thread.lock at remote 0x7f958713e480>, acquire=<built-in method acquire of _thread.lock object at remote 0x7f958713e480>, release=<built-in method release of _thread.lock object at remote 0x7f958713e480>, _waiters=<collections.deque at remote 0x7f958799ffa0>) at remote 0x7f958712b3a0>, _flag=True) at remote 0x7f958712b370>, _is_stopped=False, _initialized=True, _stderr=<_io.TextIOWrapper at remote 0x7f9588f71220>, _invoke_excepthook=<function at remote 0x7f9587135cf0>) at remote 0x7f958712b340>), tstate=0x565071e55cb0) at ../Include/internal/pycore_ceval.h:46

85 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f95888e6180,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

86 _PyFunction_Vectorcall (func=<function at remote 0x7f95888e6170>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

87 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f95871441b0,

callable=<function at remote 0x7f95888e6170>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

88 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f95871441b0, callable=<function at remote 0x7f95888e6170>)

at ../Include/cpython/abstract.h:123

89 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e5d80, tstate=)

at ../Python/ceval.c:5891

90 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

91 0x00005650704aa927 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9587144040, for file /usr/lib/python3.10/threading.py, line 973, in _bootstrap (self=<Thread(_target=<method at remote 0x7f95868e1680>, _name='Thread-1 (run_forever)', _args=(), _kwargs={}, _daemonic=True, _ident=140280183285440, _native_id=204974, _tstate_lock=<_thread.lock at remote 0x7f958713e500>, _started=<Event(_cond=<Condition(_lock=<_thread.lock at remote 0x7f958713e480>, acquire=<buistate_lock=<_thread.lock at remote 0x7f958713e500>, _started=<Event(_cond=<Condition(_lock=<_thread.lock at remote 0x7f958713e480>, acquire=<built-in method acquire of _thread.lock object at remote 0x7f958713e480>, release=<built-in method release of _thread.lock object at remote 0x7f958713e480>, _waiters=<collections.deque at remote 0x7f958799ffa0>) at remote 0x7f958712b3a0>, _flag=True) at remote 0x7f958712b370>, _is_stopped=False, _initialized=True, _stderr=<_io.TextIOWrapper at remote 0x7f9588f71220>, _invoke_excepthook=<function at remote 0x7f9587135cf0>) at remote 0x7f958712b340>), tstate=0x565071e55cb0) at ../Include/internal/pycore_ceval.h:46

85 _PyEval_Vector (kwnames=, argcount=, args=, locals=0x0, con=0x7f95888e6180,

tstate=0x565071e55cb0) at ../Python/ceval.c:5065

86 _PyFunction_Vectorcall (func=<function at remote 0x7f95888e6170>, stack=, nargsf=,

kwnames=<optimized out>) at ../Objects/call.c:342

87 0x00005650704887c2 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=, args=0x7f95871441b0,

callable=<function at remote 0x7f95888e6170>, tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

88 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=0x7f95871441b0, callable=<function at remote 0x7f95888e6170>)

at ../Include/cpython/abstract.h:123

89 call_function (kwnames=0x0, oparg=, pp_stack=, trace_info=0x7f95867e5d80, tstate=)

at ../Python/ceval.c:5891

90 _PyEval_EvalFrameDefault (tstate=, f=, throwflag=) at ../Python/ceval.c:4198

91 0x00005650704aa927 in _PyEval_EvalFrame (throwflag=0,

f=Frame 0x7f9587144040, for file /usr/lib/python3.10/threading.py, line 973, in _bootstrap (self=<Thread(_target=<method at remote 0x7f95868e1680>, _name='Thread-1 (run_forever)', _args=(), _kwargs={}, _daemonic=True, _ident=140280183285440, _native_id=204974, _tstate_lock=<_thread.lock at remote 0x7f958713e500>, _started=<Event(_cond=<Condition(_lock=<_thread.lock at remote 0x7f958713e480>, acquire=<bui--Type <RET> for more, q to quit, c to continue without paging--

lt-in method acquire of _thread.lock object at remote 0x7f958713e480>, release=<built-in method release of _thread.lock object at remote 0x7f958713e480>, _waiters=<collections.deque at remote 0x7f958799ffa0>) at remote 0x7f958712b3a0>, _flag=True) at remote 0x7f958712b370>, _is_stopped=False, _initialized=True, _stderr=<_io.TextIOWrapper at remote 0x7f9588f71220>, _invoke_excepthook=<function at remote 0x7f9587135cf0>) at remote 0x7f958712b340>), tstate=0x565071e55cb0) at ../Include/internal/pycore_ceval.h:46

92 _PyEval_Vector (kwnames=0x0, argcount=1, args=0x7f95867e5e28, locals=0x0, con=0x7f95888e5f40, tstate=0x565071e55cb0)

at ../Python/ceval.c:5065

93 _PyFunction_Vectorcall (kwnames=0x0, nargsf=1, stack=0x7f95867e5e28, func=<function at remote 0x7f95888e5f30>)

at ../Objects/call.c:342

94 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=1, args=0x7f95867e5e28, callable=<function at remote 0x7f95888e5f30>,

tstate=0x565071e55cb0) at ../Include/cpython/abstract.h:114

95 method_vectorcall (method=, args=, nargsf=, kwnames=)

at ../Objects/classobject.c:61

96 0x00005650705ceda7 in thread_run (boot_raw=0x7f958712b510) at ../Modules/_threadmodule.c:1090

97 0x00005650705c3c48 in pythread_wrapper (arg=) at ../Python/thread_pthread.h:253

98 0x00007f9589090402 in start_thread (arg=) at ./nptl/pthread_create.c:442

99 0x00007f958911f590 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

`

orzechszek commented 1 year ago

Many crashes I've also noticed just after: May 8 03:16:10 openhab python3[3021029]: INFO:BLEGateway:Sent{"servicedatauuid": "fe95", "servicedata": "58585b05ff4b588138c1a4fad0e6e2c8f8050047ca521a", "manufacturerdata": 75004204018060f83f517e368ffa3f517e368e01000000000000", "name": "LE_WH-1000XM4", "id": "F8:3F:51:XX:XX:XX", "rssi": -76, "mfr": "Samsung Electronics Co. Ltd."}to topichome/TheengsGateway/BTtoMQTT/F83F51XXXXXX

DigiH commented 5 months ago

Many crashes I've also noticed just after:

In case this undecoded and unknown "LE_WH-1000XM4" headset, with its very long servicedata and manufacturerdata, is actually the cause of the crash, could you test starting with -pa 0

-pa PUBLISH_ALL, --publish_all PUBLISH_ALL Publish all (1) or only decoded (0) advertisements (default:1)