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

Segfault on XPeria X when stopping scan #55

Closed
cnlpete opened this issue Oct 7, 2020 · 7 comments
Closed

Segfault on XPeria X when stopping scan #55

cnlpete opened this issue Oct 7, 2020 · 7 comments

Comments

@cnlpete
Copy link
Contributor

cnlpete commented Oct 7, 2020

A segfault happens when i stop the daemon (deactivate scan and send switch).

Since the received contacts are apparently only saved upon a day switch, this means all received contacts are lost. whenever the daemon crashes..
A quick workaround would be to save the contacts every once in a while and also when closing the application. I did not find the code that saves the contacts when closing the daemon, only the dayswitch seems to do this now.

[D] unknown:0 - QML debugging is enabled. Only use this in a safe environment.
[D] main:31 - contrac VERSION string: 0.7.1
[D] main:32 - VERSION_MAJOR: 0
[D] main:33 - VERSION_MINOR: 7
[D] main:34 - VERSION_BUILD: 1
[D] Settings::Settings:19 - Settings created:  "/home/nemo/.config/contracd/contracd.conf"
[D] Settings::upgrade:148 - Existing settings file version:  0
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:81 - Contrac
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:83 - Controller
[D] BleAdvertisement::setServiceData:178 - Service data value:  "48656c6c6f"
[D] BleAdvertisement::registerDBus:45 - Registering:  "/uk/co/flypig/advert1"
[D] BleAdvertisement::registerDBus:48 - Connecting
[D] BleAdvertisement::registerDBus:56 - Registering object
[D] BleAdvertisementManager::connectDBus:28 - Registering interface
[D] BleAdvertisementManager::connectDBus:35 - Connecting property change
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:85 - Scanner
[D] BleScanner::BleScanner:17 - Registering interface
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:87 - Contacts
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:89 - Timer
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:94 - Load
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:103 - Using existing tracing key
[D] ContactStorage::onTimeChanged:38 - Storage day set to  18542
[D] ContactStorage::harvestOldData:107 - Harvesting file:  "00000000.dat"
[D] ExposureNotificationPrivate::ExposureNotificationPrivate:108 - Connections
[D] DBusInterface::DBusInterface:13 - CONTRAC: Initialising the dbus interface
[D] DBusInterface::DBusInterface:34 - CONTRAC: service registration:  true
[D] DBusInterface::DBusInterface:38 - CONTRAC: object registration:  true
[D] DBusInterface::DBusInterface:41 - CONTRAC: DBus registered:  true
[D] main:58 - Execution started
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::start:78 - CONTRAC: start()
[D] BleScanner::applyDiscoveryFilter:97 - Setting up discovery filter
[D] Controller::registerAdvert:42 - Registering advertisement
[D] BleAdvertisementManager::registerAdvertisement:65 - Registering advertisement:  "/uk/co/flypig/advert1"
[D] BleScanner::applyDiscoveryFilter()::<lambda:108 - DBus SetDiscoveryFilter returned
[D] BleScanner::applyDiscoveryFilter()::<lambda:115 - Filtering not supported
[D] BleScanner::startDiscovery:147 - Starting discovery
[D] BleAdvertisementManager::registerAdvertisement(BleAdvertisement*)::<lambda:75 - DBus RegisterAdvertisement call returned
[D] BleAdvertisementManager::registerAdvertisement(BleAdvertisement*)::<lambda:82 - No error
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] BleScanner::startDiscovery()::<lambda:155 - DBus StartDiscovery returned
[D] BleScanner::startDiscovery()::<lambda:162 - No error
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] ExposureNotification::intervalUpdate:572 - intervalUpdate
[D] DBusInterface::isBusy:102 - CONTRAC: isBusy()
[D] DBusInterface::isEnabled:96 - CONTRAC: isEnabled()
[D] DBusInterface::stop:84 - CONTRAC: stop()
[D] BleScanner::stopDiscovery:201 - Stopping discovery
[D] Controller::unRegisterAdvert:52 - Unregistering advertisement
[D] BleAdvertisementManager::unRegisterAdvertisement:90 - Unregistering advertisement:  "/uk/co/flypig/advert1"
[D] BleAdvertisementManager::unRegisterAdvertisement(BleAdvertisement*)::<lambda:100 - DBus UnregisterAdvertisement call returned
[D] BleAdvertisementManager::unRegisterAdvertisement(BleAdvertisement*)::<lambda:104 - Error:  "Does Not Exist"
[D] BleScanner::stopDiscovery()::<lambda:209 - DBus StopDiscovery returned
[D] BleScanner::stopDiscovery()::<lambda:216 - No error
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery
[...]
SegFault

Note, the X does not seem to support the ble filter stuff, but contacts are properly received.

Second Note, i cut the log, since the line "[D] BleScanner::removeDiscoveryFilter:194 - No discovery filter to remove, moving straight to stop discovery" does not stop comming (only when the segfault is reached)

@cnlpete
Copy link
Contributor Author

cnlpete commented Oct 7, 2020

I entered this information in #28 but then i was not aware, that this would mean that i loose all data everytime the daemon is stopped

@triessner
Copy link

triessner commented Oct 7, 2020

I use contrac 0.7.1 on my sony xperia xa2. I had a hard crash of the whole bluetooth system yesterday (nothing related to bluetooth worked anymore, handsfree, bt-speaker,...) and I had to reboot may phone. After the reboot the counters for sent and received beacons jumped back from over 1000 to roughly 500, which was the value several days before. It seams, contrac lost much more than one days beacon-information.
But nevertheless, thanks for all your work and that we now have a corona-warn-app on the official servers under Sailfish-OS.

@llewelld
Copy link
Owner

llewelld commented Oct 7, 2020

Having looked at the logs again (thank you both for providing them; they've very helpful), it seems I made a mistake in the logic of the state machine (see #56) and possibly if this is fixed it may prevent the segfault

Unfortunately my Xperia X is unusable (a cracked screen that's deteriorated), so I can't test this properly, but I'll push out the change in the next release and would be grateful for feedback on whether you still get the segfaults afterwards.

Concerning the sent/received counters, as you've discovered these get saved when the daemon shuts down, so if the daemon dies badly the most recent changes to these will be lost. But the important data is the list of beacons received and the associated bloom filters, which are saved out at least daily and stored in ~/.config/contracd/contracd/contacts/. So although you will lose some data, it should hopefully not be more than a day's worth, even if the counters suggest otherwise.

@llewelld
Copy link
Owner

llewelld commented Oct 8, 2020

This change is now in 0.7.3 on OpenRepos.

@cnlpete, @triessner: could you please me know whether this fixes the segfault on shutdown you've been experiencing, and if so, whether you're happy for this bug to be closed?

@cnlpete
Copy link
Contributor Author

cnlpete commented Oct 8, 2020

The segfault on shutdown is fixed, but the applyDiscovery filter has the same problem (and leads to an infinite loop). My guess is to move line 104 to 95, which is basically the same fix as you did in removeDiscoveryFilter.

@llewelld
Copy link
Owner

llewelld commented Oct 8, 2020

Thanks for the super-fast response @cnlpete and for figuring out the solution. I've pushed out a new version (0.7.4), hopefully this one will do the trick.

@cnlpete
Copy link
Contributor Author

cnlpete commented Oct 9, 2020

Yes, starting/stopping the daemon now seems to work with 0cc539c. Thank you for the quick fix (and release) 👍

@cnlpete cnlpete closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants