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

Bluetoothd crash caused by call to adapter.discover_devices #26

Closed
AidanWoolley opened this issue Feb 23, 2022 · 3 comments
Closed

Bluetoothd crash caused by call to adapter.discover_devices #26

AidanWoolley opened this issue Feb 23, 2022 · 3 comments
Labels
external caused by bluetoothd or kernel

Comments

@AidanWoolley
Copy link

AidanWoolley commented Feb 23, 2022

On armv7, kernel 5.4.70, with bluez 5.55, 5.60 or 5.63, the following program always causes bluetoothd to crash with SIGABRT due to corrupted memory. This seems to be due to the cleanup for the device stream: if you uncomment the loop, the crash will not occur until you press ctrl-c to terminate the program.

#[tokio::main(flavor = "current_thread")]
async fn main() -> bluer::Result<()> {
    let session = bluer::Session::new().await?;
    let adapter = session.default_adapter().await?;
    println!("Discovering devices using Bluetooth adapter {}", adapter.name());
    adapter.set_powered(true).await?;

    let device_events = adapter.discover_devices().await?;
    futures::pin_mut!(device_events);
    // loop {}
    Ok(())
}

I'm posting this issue here because the equivalent commands in bluetoothctl cause no issue.

power on
scan on
scan off
exit
@AidanWoolley
Copy link
Author

Logs from journalctl are attached:

Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:set_discovery_filter() sender :1.114
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:parse_discovery_filter_dict() filtered discovery params: transport: 7 rssi: 32767 pathloss: 32767  duplicate data: false discoverable false pattern (null)
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:set_discovery_filter() successfully pre-set filter
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:start_discovery() sender :1.114
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:update_discovery_filter()
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:discovery_filter_to_mgmt_cp()
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:trigger_start_discovery()
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:cancel_passive_scanning()
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:start_discovery_timeout()
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:start_discovery_timeout() adapter->current_discovery_filter == 1
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:start_discovery_timeout() sending MGMT_OP_START_SERVICE_DISCOVERY 127, 7, 0
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:start_discovery_complete() status 0x00
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:discovering_callback() hci0 type 7 discovering 1 method 1
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:discovery_disconnect() owner :1.114
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:stop_discovery_complete() status 0x00
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:discovery_remove() owner :1.114
Feb 23 12:05:56 test-device bluetoothd[4404]: free(): invalid next size (fast)
Feb 23 12:05:56 test-device bluetoothd[4404]: ../bluez-5.55/src/adapter.c:discovery_free() 0x16e8b50
Feb 23 12:05:56 test-device systemd[1]: bluetooth.service: Main process exited, code=killed, status=6/ABRT
Feb 23 12:05:56 test-device systemd[1]: bluetooth.service: Failed with result 'signal'.

@surban
Copy link
Collaborator

surban commented Feb 23, 2022

This is still a bluetoothd bug, since the daemon should not crash no matter what a user space process does.

I think we have seen something similar before and it was related to libdbus, so maybe it should be reported there. But difficult to say with a core dump or at least stack trace.

@AidanWoolley
Copy link
Author

Thanks very much for the hint - I found my exact issue in bluez issue 196 which also points to DBus, so I'll see if I can find a workaround from there...

@surban surban added the external caused by bluetoothd or kernel label Feb 23, 2022
otaviojr added a commit to otaviojr/bluer that referenced this issue May 10, 2023
# This is the 1st commit message:

BLE Passive Scanning

# This is the commit message #2:

monitor

# This is the commit message bluez#3:

monitor

# This is the commit message bluez#4:

monitor

# This is the commit message bluez#5:

monitor

# This is the commit message bluez#6:

monitor

# This is the commit message bluez#7:

monitor

# This is the commit message bluez#8:

monitor

# This is the commit message bluez#9:

monitor

# This is the commit message bluez#10:

monitor

# This is the commit message bluez#11:

monitor

# This is the commit message bluez#12:

monitor

# This is the commit message bluez#13:

monitor

# This is the commit message bluez#14:

monitor

# This is the commit message bluez#15:

monitor

# This is the commit message bluez#16:

monitor

# This is the commit message bluez#17:

monitor

# This is the commit message bluez#18:

monitor

# This is the commit message bluez#19:

monitor

# This is the commit message bluez#20:

monitor

# This is the commit message bluez#21:

monitor

# This is the commit message bluez#22:

monitor

# This is the commit message bluez#23:

monitor

# This is the commit message bluez#24:

monitor

# This is the commit message bluez#25:

monitor

# This is the commit message bluez#26:

monitor

# This is the commit message bluez#27:

monitor

# This is the commit message bluez#28:

monitor

# This is the commit message bluez#29:

monitor

# This is the commit message bluez#30:

monitor

# This is the commit message bluez#31:

monitor

# This is the commit message bluez#32:

monitor

# This is the commit message bluez#33:

monitor

# This is the commit message bluez#34:

monitor

# This is the commit message bluez#35:

monitor

# This is the commit message bluez#36:

monitor

# This is the commit message bluez#37:

monitor

# This is the commit message bluez#38:

monitor

# This is the commit message bluez#39:

monitor

# This is the commit message bluez#40:

monitor

# This is the commit message bluez#41:

monitor

# This is the commit message bluez#42:

monitor

# This is the commit message bluez#43:

monitor

# This is the commit message bluez#44:

monitor

# This is the commit message bluez#45:

monitor

# This is the commit message bluez#46:

monitor

# This is the commit message bluez#47:

monitor

# This is the commit message bluez#48:

monitor

# This is the commit message bluez#49:

monitor

# This is the commit message bluez#50:

monitor

# This is the commit message bluez#51:

monitor

# This is the commit message bluez#52:

monitor

# This is the commit message bluez#53:

monitor

# This is the commit message bluez#54:

monitor

# This is the commit message bluez#55:

monitor

# This is the commit message bluez#56:

monitor

# This is the commit message bluez#57:

monitor

# This is the commit message bluez#58:

monitor

# This is the commit message bluez#59:

monitor

# This is the commit message bluez#60:

monitor

# This is the commit message bluez#61:

monitor

# This is the commit message bluez#62:

monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external caused by bluetoothd or kernel
Projects
None yet
Development

No branches or pull requests

2 participants