piggz / harbour-amazfish

Amazfit Bip support for SailfishOS
GNU General Public License v3.0
103 stars 51 forks source link

Segmentation fault (core dumped) when downloading data #174

Open spag opened 3 years ago

spag commented 3 years ago

harbour-amazfishd crashes after receiving data from the watch for several minutes:

...
[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "15700000ff700000ff700000ff700000ff"
[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "16700000ff700000ff700000ff700000ff"
[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "17700000ff700000ff700000ff700000ff"
[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "18700000ff700000ff700000ff700000ff"
[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "19700000ff700e00ff700000ff700000ff"
[D] unknown:0 - MiBand Changed: "00000004-0000-3512-2118-0009af100700" "100201"
[D] unknown:0 - ...got metadata
[D] unknown:0 - AbstractFetchOperation::handleMetaData: "\x10\x02\x01"
[D] unknown:0 - Finished sending data
Segmentation fault (core dumped)

UI seems not to be affected other than by the fact it keeps displaying the spinner forever.

Version: harbour-amazfish-1.9.7-1.18.1.jolla.armv7hl Watch: Amazfit BIP SFOS: 4.0.1.48

piggz commented 3 years ago

Please check 2.0.0

spag commented 3 years ago

Version : 2.0.0+master.20210510082230.b199678

When I start harbour-amazfishd from terminal on the device it segfaults instantly, when I run it over ssh (either from laptop or from terminal on the device but through "ssh localhost") it seems not to throw any Segmentation faults any more.

Downloading data from the watch seems not to work, though.

I can see the following notification (always showing exactly this timestamp): About to transfer data from Mon Apr 26 23:50:00 2021 GMT

And harbour-amazfishd seems to be receiving data:

[D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "6c500000ff500000ff500000ff500000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "6d500000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "6e700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "6f700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "70700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "71700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "72700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "73700000ff700000ff700200ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "74700000ff700000ff700000ff700100ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "75700000ff700000ff700000ff700000ff" [D] unknown:0 - MiBand Changed: "00000005-0000-3512-2118-0009af100700" "76700200ff700f00ff70000054" [D] unknown:0 - MiBand Changed: "00000004-0000-3512-2118-0009af100700" "100201" [D] unknown:0 - ...got metadata [D] unknown:0 - AbstractFetchOperation::handleMetaData: "\x10\x02\x01" [D] unknown:0 - Finished sending data [D] unknown:0 - Database not connected [D] unknown:0 - Last sample time is as "" 0 0 [D] unknown:0 - Last sample time saved as "" 0 0 [D] unknown:0 - finished fetch operation, last record was QDateTime( Qt::TimeSpec(LocalTime)) [D] unknown:0 - Incoming notification 310 Notification(appId="harbour-amazfish", appName="harbour-amazfish", summary="", body="", appIcon="", hints=QHash(("x-nemo-preview-body", "Finished transferring activity data")("x-nemo-owner", "harbour-amazfish")("x-nemo-preview-summary", "")), timeout=5000, actions=()) [D] unknown:0 - is firmware operation running: 0

But no data graphs appear inside the UI.

piggz commented 3 years ago

Crashes are usually caused by an old copy of libicu

Please provide "zypper se -s icu"

spag commented 3 years ago
[nemo@Sailfish ~]$ zypper se -s icu
Loading repository data...
Reading installed packages...

S  | Name            | Type       | Version                | Arch    | Repository
---+-----------------+------------+------------------------+---------+------------------
   | harfbuzz-icu    | package    | 2.7.2+git1-1.3.6.jolla | armv7hl | jolla
   | icu             | package    | 68.2+git1-1.3.3.jolla  | armv7hl | jolla
   | icu             | srcpackage | 68.2+git1-1.3.3.jolla  | noarch  | jolla
   | icu-debuginfo   | package    | 68.2+git1-1.3.3.jolla  | armv7hl | jolla
   | icu-debugsource | package    | 68.2+git1-1.3.3.jolla  | armv7hl | jolla
i+ | libicu          | package    | 68.2+git1-1.3.3.jolla  | armv7hl | jolla
   | libicu-devel    | package    | 68.2+git1-1.3.3.jolla  | armv7hl | jolla
   | libicu-doc      | package    | 68.2+git1-1.3.3.jolla  | noarch  | jolla
i  | libicu52        | package    | 52.1+git6-1.4.1.jolla  | armv7hl | (System Packages)
piggz commented 3 years ago

Yup, remove libicu52

piggz commented 2 years ago

Is this resolved?

Thaodan commented 4 months ago

Still same issue, also crashes after selecting a file that is to send before actually pressing download.

Thaodan commented 4 months ago

When pressing download it crashes in bool DeviceInterface::startDownload()

jmlich commented 4 months ago

Can you provide back trace please?

Thaodan commented 4 months ago

Back trace after selecting a file to download (a theme for the watch):

#0  AbstractFirmwareInfo::type (this=0x0) at src/devices/abstractfirmwareinfo.cpp:16
#1  0x00000000004dc6b8 in DeviceInterface::prepareFirmwareDownload (this=0x7fff0fd6f8, path=...) at src/deviceinterface.cpp:750
#2  0x00000000004f2d8c in DeviceInterface::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7fff0fd068)
    at moc_deviceinterface.cpp:307
#3  0x00000000004f3010 in DeviceInterface::qt_metacall (this=0x7fff0fd6f8, _c=QMetaObject::InvokeMetaMethod, _id=28, _a=0x7fff0fd068)
    at moc_deviceinterface.cpp:423
#4  0x0000007320ed9c58 in ?? () from /usr/lib64/libQt5DBus.so.5
#5  0x0000007320ededd8 in ?? () from /usr/lib64/libQt5DBus.so.5
#6  0x0000007320edf5d0 in ?? () from /usr/lib64/libQt5DBus.so.5
#7  0x0000007320ee1d84 in ?? () from /usr/lib64/libQt5DBus.so.5
#8  0x0000007320b788cc in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#9  0x0000007320b4bb64 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#10 0x0000007320b4dfcc in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#11 0x0000007320b9f208 in ?? () from /usr/lib64/libQt5Core.so.5
#12 0x000000731e4e44dc in ?? () from /usr/lib64/libglib-2.0.so.0
#13 0x000000731e4e7648 in ?? () from /usr/lib64/libglib-2.0.so.0
#14 0x000000731e4e7e34 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#15 0x0000007320b9f67c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#16 0x0000007320b49f84 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#17 0x0000007320b519e4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#18 0x0000000000419e28 in main (argc=<optimized out>, argv=<optimized out>) at src/harbour-amazfish-daemon.cpp:53
Thaodan commented 4 months ago

After pressing send file:

#0  0x00000000004d2fac in DeviceInterface::startDownload (this=0x7fe661ad08) at src/deviceinterface.cpp:763
#1  0x00000000004f2da4 in DeviceInterface::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7fe661a678)
    at moc_deviceinterface.cpp:309
#2  0x00000000004f3010 in DeviceInterface::qt_metacall (this=0x7fe661ad08, _c=QMetaObject::InvokeMetaMethod, _id=29, _a=0x7fe661a678)
    at moc_deviceinterface.cpp:423
#3  0x0000007807fa1c58 in ?? () from /usr/lib64/libQt5DBus.so.5
#4  0x0000007807fa6dd8 in ?? () from /usr/lib64/libQt5DBus.so.5
#5  0x0000007807fa75d0 in ?? () from /usr/lib64/libQt5DBus.so.5
#6  0x0000007807fa9d84 in ?? () from /usr/lib64/libQt5DBus.so.5
#7  0x0000007807c408cc in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#8  0x0000007807c13b64 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#9  0x0000007807c15fcc in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#10 0x0000007807c67208 in ?? () from /usr/lib64/libQt5Core.so.5
#11 0x00000078055ac4dc in ?? () from /usr/lib64/libglib-2.0.so.0
#12 0x00000078055af648 in ?? () from /usr/lib64/libglib-2.0.so.0
#13 0x00000078055afe34 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#14 0x0000007807c6767c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#15 0x0000007807c11f84 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#16 0x0000007807c199e4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#17 0x0000000000419e28 in main (argc=<optimized out>, argv=<optimized out>) at src/harbour-amazfish-daemon.cpp:53
jmlich commented 4 months ago

It seems that your device is Amazfit BIP S, not Amazfit BIP. It seems that firmware info for this device is not implemented:

https://github.com/piggz/harbour-amazfish/blob/62460cc97b4308f3908de33489e14af0322b146e/daemon/src/devices/bipsdevice.cpp#L139-L142

As a consequence the amazfish daemon crashes. I have added as sanity check in https://github.com/piggz/harbour-amazfish/pull/370 to avoid crashes, but feature will not work anyway. The implementation could be probably done according to https://github.com/Freeyourgadget/Gadgetbridge/blob/f05043481ce85a80db3a8c93efbcc14f7d7da963/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSFirmwareInfo.java but I don't have device to do it.

jmlich commented 4 months ago

rpm files are included in output of github actions https://github.com/piggz/harbour-amazfish/actions/runs/9015367857 It would be great if you can check, that proposed check helps to you case.

Thaodan commented 4 months ago

Jozef Mlich @.***> writes:

rpm files are included in output of github actions https://github.com/piggz/harbour-amazfish/actions/runs/9015367857 It would be great if you can check, that proposed check helps to you case.

I built on our OBS but yes I can try the change.

IMHO it would be better if it possible to decifer if firmwareInfo fails if the feature isn't implemented or because of a malfunction.

Also the code should use QCWarning and not just QCWarning.

Regarding Qt logging categories CMake with ECM would make a lot of things easier.