Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

log buffer overflow on nrf52832 #69

Closed
oni303 opened this issue Jul 25, 2019 · 7 comments
Closed

log buffer overflow on nrf52832 #69

oni303 opened this issue Jul 25, 2019 · 7 comments
Labels
area: utils Code Area: Utilities and scaffolding used throughout the project good first issue Call for participation: Good for newcomers status: needs code An implementation or a bugfix need to be written type: bug Something isn't behaving as intended
Milestone

Comments

@oni303
Copy link

oni303 commented Jul 25, 2019

I get a buffer overflow when I try to run the rubble-demo on a nrf52832.

panicked at 'log buffer overflow: failed to grant 4 Bytes (0 available)', rubble-demo/src/logger.rs:70:21
I tried to add --features="log" and --features="rubble/log" during build, did not make any difference.

To "port" the demo form nrf528100 to the nrf52832 I simply replaced nrf528100 with nrf52832.

Any ideas?

@jonas-schievink
Copy link
Owner

This does happen spuriously sometimes when there's a lot of devices around (which we should definitely fix), do you get no serial output at all before this happens?

@jonas-schievink jonas-schievink added the type: bug Something isn't behaving as intended label Jul 25, 2019
@oni303
Copy link
Author

oni303 commented Jul 25, 2019

Well lost of devices are definitely around.
There are sometimes some lines printed. Here are all the outputs of gdb, openocd and serial:

GDB:

Continuing.

Program	received signal	SIGTRAP, Trace/breakpoint trap.
0x00003f16 in __bkpt ()	at rubble/src/link/comp_id.rs:1968

openocd:

xPSR: 0x01000000 pc: 0x0000d440 msp: 0x20008000, semihosting

<< INIT >>

panicked at 'log buffer overflow: failed to grant 18 Bytes (0 available)', rubble-demo/src/logger.rs:70:21

serial:


--- INIT ---
INFO - Logger ready
3.744ms - TRACE - new LinkLayer, dev=91:c0:25:41:4b:b3(Random)
4.060ms - DEBUG - start_advertise: adv_data = [CompleteLocalName("CONCVRRENS CERTA CELERIS")]
4.409ms - DEBUG - start_advertise: PDU = (Header { PDU Type: AdvInd, TxAdd: true, RxAdd: false, len: 35 }, [91, c0, 25, 41, 4b, b3, 02, 01, 06, 19, 09, 43, 4f, 4e, 43, 56, 52, 52, 45, 4e, 53, 20, 43, 45, 52, 54, 41, 20, 43, 45, 4c, 45, 52, 49, 53])
5.871ms - TRACE - ADV<- Header { PDU Type: AdvNonconnInd, TxAdd: true, RxAdd: false, len: 37 }, [4f, 1b, c5, db, 54, 38, 1e, ff, 06, 00, 01, 09, 20, 02, b8, e5, 50, d7, c8, 63, 83, f8, fe, f4, d2, 83, f6, 86, ae, 35, 9b, 47, 17, 6c, 85, 0a, e4]
212.097ms - Ok(NonconnectableUndirected { advertiser_addr: 4f:1b:c5:db:54:38(Random), advertising_data: [Unknown { ty: 255, data: [6, 0, 1, 9, 32, 2, 184, 229, 80, 215, 200, 99, 131, 248, 254, 244, 210, 131, 246, 134, 174, 53, 155, 71, 23, 108, 133, 10, 228] }] })
213.342ms - 
213.400ms - TRACE - ADV<- Header { PDU Type: AdvInd, TxAdd: true, RxAdd: false, len: 20 }, [ea, 53, 5f, d0, 04, 75, 02, 01, 1a, 0a, ff, 4c, 00, 10, 05, 01, 1c, 1e, ed, 4b]
240.029ms - Ok(ConnectableUndirected { advertiser_addr: ea:53:5f:d0:04:75(Random), advertising_data: [Flags(LE_GENERAL_DISCOVERABLE | SIMUL_LE_BR_CONTROLLER | SIMUL_LE_BR_HOST), Unknown { ty: 255, data: [76, 0, 16, 5, 1, 28, 30, 237, 75] }] })
240.889ms - 
240.948ms - TRACE - ADV<- Header { PDU Type: AdvInd, TxAdd: true, RxAdd: false, len: 20 }, [f``` 

@jonas-schievink
Copy link
Owner

Yeah then the buffer just gets too full due to the many devices. I meant to fix this yesterday but didn't get to it, so if you want to fix this please go ahead.

The panic happens here:

panic!(
"log buffer overflow: failed to grant {} Bytes ({} available)",
bytes.len(),
max_len
);

When the queue runs out of space we should instead set a flag on the BbqLogger and drop the rest of the message. Then we need to make sure to print an ellipsis () as the next character by checking and resetting the flag at the beginning of write_str.

@oni303
Copy link
Author

oni303 commented Jul 25, 2019

At the moment I am still learning a lot every time I read/write rust code. So my fixing might take a while.

@jonas-schievink
Copy link
Owner

No problem, take your time! Let me know if you have any questions.

@jonas-schievink jonas-schievink added area: utils Code Area: Utilities and scaffolding used throughout the project status: needs code An implementation or a bugfix need to be written labels Aug 15, 2019
@jonas-schievink jonas-schievink added this to the 0.1.0 milestone Sep 23, 2019
@jonas-schievink jonas-schievink added the good first issue Call for participation: Good for newcomers label Nov 3, 2019
@thalesfragoso
Copy link
Contributor

Can we close this ?

@jonas-schievink
Copy link
Owner

Yep, should be fixed!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: utils Code Area: Utilities and scaffolding used throughout the project good first issue Call for participation: Good for newcomers status: needs code An implementation or a bugfix need to be written type: bug Something isn't behaving as intended
Projects
None yet
Development

No branches or pull requests

3 participants