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

Core dump running Python Lighting example on Raspberry Pi 4 #21969

Closed
sandeepmistry opened this issue Aug 17, 2022 · 2 comments · Fixed by #22498
Closed

Core dump running Python Lighting example on Raspberry Pi 4 #21969

sandeepmistry opened this issue Aug 17, 2022 · 2 comments · Fixed by #22498
Labels

Comments

@sandeepmistry
Copy link
Contributor

Problem

I'm trying to run the Python based lighting example on a Raspberry Pi 4 running Ubuntu 22.04 but get a core dump:

(python_env) root@ubuntu:/home/ubuntu/connectedhomeip-python/examples/lighting-app/python# python lighting.py 
[1660745048.570696][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_kvs-3HkuYN)
[1660745048.574383][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_kvs)
[1660745048.579531][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-HPFg6a)
[1660745048.579798][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1660745048.580077][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_config.ini-8COg8H)
[1660745048.580246][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1660745048.580495][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-x0oe1E)
[1660745048.580656][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1660745048.580986][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-Dhxgk3)
[1660745048.581580][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1660745048.581647][79754:79754] CHIP:DL: NVS set: chip-factory/unique-id = "6E43A2356AA3FE56"
[1660745048.581842][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-C2Dly8)
[1660745048.582491][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1660745048.582559][79754:79754] CHIP:DL: NVS set: chip-factory/vendor-id = 65521 (0xFFF1)
[1660745048.582744][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-IhvBPE)
[1660745048.583263][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1660745048.583328][79754:79754] CHIP:DL: NVS set: chip-factory/product-id = 32769 (0x8001)
[1660745048.583542][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-T9ukQV)
[1660745048.584009][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1660745048.584073][79754:79754] CHIP:DL: NVS set: chip-counters/reboot-count = 1 (0x1)
[1660745048.584246][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-qhIzBw)
[1660745048.584833][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1660745048.584897][79754:79754] CHIP:DL: NVS set: chip-counters/total-operational-hours = 0 (0x0)
[1660745048.585075][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-BbysPT)
[1660745048.585869][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1660745048.585931][79754:79754] CHIP:DL: NVS set: chip-counters/boot-reason = 0 (0x0)
[1660745048.586104][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_config.ini-iaRuzO)
[1660745048.586599][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1660745048.586659][79754:79754] CHIP:DL: NVS set: chip-config/regulatory-location = 0 (0x0)
[1660745048.586803][79754:79754] CHIP:DL: writing settings to file (/tmp/chip_config.ini-KkBBCZ)
[1660745048.587847][79754:79754] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1660745048.587899][79754:79754] CHIP:DL: NVS set: chip-config/location-capability = 2 (0x2)
[1660745048.588413][79754:79754] CHIP:DL: Got Ethernet interface: eth0
[1660745048.588725][79754:79754] CHIP:DL: Found the primary Ethernet interface:eth0
[1660745048.589077][79754:79754] CHIP:DL: Got WiFi interface: wlan0
[1660745048.589143][79754:79754] CHIP:DL: Failed to reset WiFi statistic counts
[1660745048.589181][79754:79754] CHIP:DL: Device Configuration:
[1660745048.589255][79754:79754] CHIP:DL:   Serial Number: TEST_SN
[1660745048.589310][79754:79754] CHIP:DL:   Vendor Id: 65521 (0xFFF1)
[1660745048.589347][79754:79754] CHIP:DL:   Product Id: 32769 (0x8001)
[1660745048.589379][79754:79754] CHIP:DL:   Hardware Version: 0
Aborted (core dumped)

I had to apply the follow patch to get in building (will make a pull request for this at a later date):

diff --git a/scripts/build_python_device.sh b/scripts/build_python_device.sh
index 30779c6ab..894ea1bad 100755
--- a/scripts/build_python_device.sh
+++ b/scripts/build_python_device.sh
@@ -104,7 +104,7 @@ gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_deta
 if [ "$enable_pybindings" == true ]; then
     ninja -v -C "$OUTPUT_ROOT" pycontroller
 else
-    ninja -v -C "$OUTPUT_ROOT" chip-library
+    ninja -v -C "$OUTPUT_ROOT" chip-core
 fi
 
 # Create a virtual environment that has access to the built python tools
@@ -115,7 +115,7 @@ virtualenv --clear "$ENVIRONMENT_ROOT"
 if [ "$enable_pybindings" == true ]; then
     WHEEL=("$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl)
 else
-    WHEEL=("$OUTPUT_ROOT"/controller/python/chip_library*.whl)
+    WHEEL=("$OUTPUT_ROOT"/controller/python/chip_core*.whl)
 fi

Proposed Solution

N/A

@mrjerryjohns
Copy link
Contributor

Thank you, a PR would be much apprecaited!

@sandeepmistry
Copy link
Contributor Author

sandeepmistry commented Sep 8, 2022

Some more insights on this after testing on a Ubuntu 20.04 x86 VM:

TLDR:

[1662659697.193593][16263:16263] CHIP:SPT: VerifyOrDie failure at ../../src/platform/CommissionableDataProvider.cpp:32: gCommissionableDataProvider != nullptr

Full app log:

$ python lighting.py 
[1662659697.185655][16263:16263] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_kvs
[1662659697.187538][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_kvs-lhMDiX)
[1662659697.187868][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_kvs)
[1662659697.188096][16263:16263] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_factory.ini
[1662659697.188259][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-pPjR6V)
[1662659697.188357][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1662659697.188441][16263:16263] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_config.ini
[1662659697.188544][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_config.ini-37RmoW)
[1662659697.188620][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1662659697.188702][16263:16263] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_counters.ini
[1662659697.188796][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-sZPDgU)
[1662659697.188872][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1662659697.189016][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-CbDsgW)
[1662659697.189248][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1662659697.189278][16263:16263] CHIP:DL: NVS set: chip-factory/unique-id = "0BCE0E82C21551DE"
[1662659697.189534][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-deKb9U)
[1662659697.189732][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1662659697.189818][16263:16263] CHIP:DL: NVS set: chip-factory/vendor-id = 65521 (0xFFF1)
[1662659697.189910][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_factory.ini-sjk3xV)
[1662659697.190093][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_factory.ini)
[1662659697.190236][16263:16263] CHIP:DL: NVS set: chip-factory/product-id = 32769 (0x8001)
[1662659697.190329][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-QtBUkW)
[1662659697.190652][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1662659697.190760][16263:16263] CHIP:DL: NVS set: chip-counters/reboot-count = 1 (0x1)
[1662659697.190860][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-lpFHPU)
[1662659697.191031][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1662659697.191150][16263:16263] CHIP:DL: NVS set: chip-counters/total-operational-hours = 0 (0x0)
[1662659697.191246][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-3Zty6W)
[1662659697.191433][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1662659697.191518][16263:16263] CHIP:DL: NVS set: chip-counters/boot-reason = 0 (0x0)
[1662659697.191602][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_config.ini-ZTtpLX)
[1662659697.191797][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1662659697.191915][16263:16263] CHIP:DL: NVS set: chip-config/regulatory-location = 0 (0x0)
[1662659697.192002][16263:16263] CHIP:DL: writing settings to file (/tmp/chip_config.ini-YOzlSV)
[1662659697.192215][16263:16263] CHIP:DL: renamed tmp file to file (/tmp/chip_config.ini)
[1662659697.192329][16263:16263] CHIP:DL: NVS set: chip-config/location-capability = 2 (0x2)
[1662659697.192530][16263:16263] CHIP:DL: Got Ethernet interface: enp0s5
[1662659697.192614][16263:16263] CHIP:DL: Found the primary Ethernet interface:enp0s5
[1662659697.192697][16263:16263] CHIP:DL: Failed to get WiFi interface
[1662659697.192718][16263:16263] CHIP:DL: Failed to reset WiFi statistic counts
[1662659697.192752][16263:16263] CHIP:DL: Device Configuration:
[1662659697.192799][16263:16263] CHIP:DL:   Serial Number: TEST_SN
[1662659697.193447][16263:16263] CHIP:DL:   Vendor Id: 65521 (0xFFF1)
[1662659697.193579][16263:16263] CHIP:DL:   Product Id: 32769 (0x8001)
[1662659697.193589][16263:16263] CHIP:DL:   Hardware Version: 0
[1662659697.193593][16263:16263] CHIP:SPT: VerifyOrDie failure at ../../src/platform/CommissionableDataProvider.cpp:32: gCommissionableDataProvider != nullptr

Backtrace from gdb:

Thread 1 "python" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7de7859 in __GI_abort () at abort.c:79
#2  0x00007ffff6992617 in chipAbort() () at ../../src/lib/support/CodeUtils.h:506
#3  0x00007ffff6afe42a in chip::DeviceLayer::GetCommissionableDataProvider() () at ../../src/platform/CommissionableDataProvider.cpp:32
#4  0x00007ffff6bee20c in chip::DeviceLayer::Internal::GenericConfigurationManagerImpl<chip::DeviceLayer::Internal::PosixConfig>::LogDeviceConfig() (this=0x7ffff6d51cb0 <chip::DeviceLayer::ConfigurationManagerImpl::GetDefaultInstance()::sInstance>)
    at ../../src/include/platform/internal/GenericConfigurationManagerImpl.ipp:695
#5  0x00007ffff699839e in pychip_server_native_init() () at ../../src/controller/python/chip/server/ServerInit.cpp:141
#6  0x00007ffff7fbcff5 in  () at /lib/x86_64-linux-gnu/libffi.so.7
#7  0x00007ffff7fbc40a in  () at /lib/x86_64-linux-gnu/libffi.so.7
#8  0x00007ffff74117c9 in _ctypes_callproc () at /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so
#9  0x00007ffff7411ae7 in  () at /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so
#10 0x00000000005f3e1e in _PyObject_MakeTpCall ()
#11 0x0000000000570674 in _PyEval_EvalFrameDefault ()
#12 0x00000000005f6836 in _PyFunction_Vectorcall ()
#13 0x000000000056b0ae in _PyEval_EvalFrameDefault ()
#14 0x000000000059bdfb in  ()
#15 0x00000000005f3d7f in _PyObject_MakeTpCall ()
#16 0x0000000000570266 in _PyEval_EvalFrameDefault ()
#17 0x000000000056939a in _PyEval_EvalCodeWithName ()
#18 0x000000000068d047 in PyEval_EvalCode ()
#19 0x000000000067e351 in  ()
#20 0x000000000067e3cf in  ()
#21 0x000000000067e471 in  ()
#22 0x000000000067e817 in PyRun_SimpleFileExFlags ()
#23 0x00000000006b6fe2 in Py_RunMain ()
#24 0x00000000006b736d in Py_BytesMain ()
#25 0x00007ffff7de90b3 in __libc_start_main (main=
    0x4eead0 <main>, argc=2, argv=0x7fffffffd9f8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd9e8) at ../csu/libc-start.c:308
#26 0x00000000005fa5ce in _start ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants