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

Makeing queries in a loop doesn't release resources. #24

Open
MrSpock opened this issue Jan 6, 2019 · 1 comment
Open

Makeing queries in a loop doesn't release resources. #24

MrSpock opened this issue Jan 6, 2019 · 1 comment

Comments

@MrSpock
Copy link

MrSpock commented Jan 6, 2019

Hi,
I have an app that is working as a daemon and after acquiring adapter is making queries then sleeps and make ble operations again.
Afer some time there is a lot open sockets and after few hours apps crashes due to exausting system resources. After few hours.

xiaomi-se 11289 root  524u  sock                0,9      0t0 1009087 protocol: HCI
xiaomi-se 11289 root  525u  sock                0,9      0t0 1009088 protocol: L2CAP
xiaomi-se 11289 root  526u  sock                0,9      0t0 1010309 protocol: HCI
xiaomi-se 11289 root  527u  sock                0,9      0t0 1010312 protocol: L2CAP

root@fx160:/proc/11289# lsof -n -p 11289|less|grep L2CAP|wc -l
198
root@fx160:/proc/11289# lsof -n -p 11289|less|grep HCI|wc -l
297

Code is basic:
There is function returning available adapter that is then used in a loop:

// return running ble interface
fn prepare_ble_interface() -> rumble::bluez::adapter::Adapter 
// inside main()
let ble_iface = prepare_ble_interface();
loop {
// make ble queries using ble_iface
//sleep for some time
}

I've tried to call prepare_ble_interface() outside loop and within where it should be deallocated every iteration. No changes. Until program is running number of open BLE sockets is increasing with every connection to ble device.

@mwylde
Copy link
Owner

mwylde commented Jan 24, 2019

Can you try with the latest version? There's a potential fix in 1813e8a which is now released as 0.3.0.

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

2 participants