Skip to content

BLEScan crashing when running for long time #3559

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

Closed
roy-zahor opened this issue Dec 10, 2019 · 4 comments
Closed

BLEScan crashing when running for long time #3559

roy-zahor opened this issue Dec 10, 2019 · 4 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@roy-zahor
Copy link

Hardware:

Board: ESP-WROOM-32D
Core Installation version: ?
IDE name: Platform.io
Flash Frequency: 40Mhz
Upload Speed: 115200
Computer OS: Windows 10

Description:

When running a BLE scan for a long time (timeout=0), or in an environment full of BLE transmitters, memory gets full and eventually leading to a system crash.

Sketch:

    BLEDevice::init("");
    pBLEScan = BLEDevice::getScan(); //create new scan
    pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
    pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster

    BLEScanResults foundDevices = pBLEScan->start(0);

In BLEScan.c, the following line (106):
BLEAdvertisedDevice *advertisedDevice = new BLEAdvertisedDevice();
is not safe, because there is no check that new() operator returned a valid address, leading to system crash in case of low memory.

@stale
Copy link

stale bot commented Feb 8, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Feb 8, 2020
@stale
Copy link

stale bot commented Feb 22, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Feb 22, 2020
@Ben79543
Copy link
Contributor

I would like this issue to be reopened:

I have a device doing BLE Scans and it works fine in general.
Yesterday I tried it in a fair where there were at least 200 beacons around me.
My scan time is 5 sec.
The device crashes and I suppose it is because of memory issue too.

@roy-zahor did you work around this on your side?

@roy-zahor
Copy link
Author

@Ben79543 Solved for me by calling clearResults() once in a while. I'm not sure you have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

2 participants