zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.55k stars 6.46k forks source link

Bluetooth: settings: Invalid base64 value written to flash #11564

Closed Qbicz closed 5 years ago

Qbicz commented 5 years ago

Describe the bug When central connects, but does not subscribe to any notification, an invalid base64 value is written to settings - after wake up the settings subsystem tries to decode the GATT CCC and crashes.

Problem occurs in subsys/bluetooth/host/gatt.c in bt_gatt_store_ccc() function when it uses settings_str_from_bytes() from subsys/settings/src/settings.c. https://github.com/zephyrproject-rtos/zephyr/blob/master/subsys/bluetooth/host/gatt.c#L2522

In the log output it's visible that settings subsystems stores BT ID, then BT keys and then tries to store BT CCC which has not been modified as some invalid base64 value.

To Reproduce Steps to reproduce the behavior:

  1. Use samples/bluetooth/peripheral_hids sample
  2. Build for nrf52_pca10040 or nrf52840_pca10056
  3. Erase flash nrfjprog -e and flash the sample
  4. From central - nRF Connect (Windows) connect to peripheral.
  5. Pair
  6. Perform discovery on HID service - e.g. open its tab in nRF Connect
  7. Do not subscribe to any notifications (do not touch CCCD).
  8. Disconnect from peripheral
  9. Reset board or go to sleep + wake up
  10. Assert:
    ASSERTION FAIL [rc == 0] @ /home/fi/ncs/zephyr/subsys/settings/src/settings_store.c:50:
        set-value operation failure

Expected behavior Value written to flash should be possible to decode or nothing should be written.

Screenshots or console output

***** Booting Zephyr OS zephyr-v1.13.0-2068-g3984361 *****
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f1c handle 0x0001 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f30 handle 0x0002 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f44 handle 0x0003 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f58 handle 0x0004 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f6c handle 0x0005 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f80 handle 0x0006 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f94 handle 0x0007 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006fb4 handle 0x0008 uuid 2a05 perm 0x01
[00:00:00.000,030] <dbg> bt_gatt.gatt_register: attr 0x20006fc8 handle 0x0009 uuid 2a05 perm 0x01
[00:00:00.000,030] <dbg> bt_gatt.gatt_register: attr 0x20006fdc handle 0x000a uuid 2a05 perm 0x00
[00:00:00.473,083] <dbg> bt_gatt.gatt_register: attr 0x20006ff0 handle 0x000b uuid 2a50 perm 0x03
[00:00:00.473,114] <dbg> bt_gatt.gatt_register: attr 0x20006c1c handle 0x000c uuid 2a50 perm 0x01
[00:00:00.473,144] <dbg> bt_gatt.gatt_register: attr 0x20006c30 handle 0x000d uuid 2a50 perm 0x01
[00:00:00.473,144] <dbg> bt_gatt.gatt_register: attr 0x20006c44 handle 0x000e uuid 2a50 perm 0x01
[00:00:00.473,175] <dbg> bt_gatt.gatt_register: attr 0x20006c58 handle 0x000f uuid 2a50 perm 0x01
[00:00:00.473,205] <dbg> bt_gatt.gatt_register: attr 0x20006c6c handle 0x0010 uuid 2a50 perm 0x01
[00:00:00.473,205] <dbg> bt_gatt.gatt_register: attr 0x20006c80 handle 0x0011 uuid 2a50 perm 0x01
[00:00:00.473,236] <dbg> bt_gatt.gatt_register: attr 0x20006c94 handle 0x0012 uuid 2a50 perm 0x01
[00:00:00.473,266] <dbg> bt_settings.bt_settings_init:
[00:00:00.475,311] <inf> bt_hci_core.hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.475,311] <inf> bt_hci_core.hci_vs_init: HW Variant: nRF52x (0x0002)
[00:00:00.475,341] <inf> bt_hci_core.hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 1.13 Build
Bluetooth initialized

[00:00:00.501,739] <dbg> bt_gatt.gatt_register: attr 0x20006b5c handle 0x0014 uuid 2a4c perm 0x01
[00:00:00.501,770] <dbg> bt_gatt.gatt_register: attr 0x20006b70 handle 0x0015 uuid 2a4c perm 0x01
[00:00:00.501,770] <dbg> bt_gatt.gatt_register: attr 0x20006b84 handle 0x0016 uuid 2a4c perm 0x03
[00:00:00.501,800] <dbg> bt_gatt.update_range: start 0x000c end 0x0012 new_start 0x0013 new_end 0x0016
[00:00:00.501,831] <dbg> bt_gatt.gatt_register: attr 0x200069f8 handle 0x0017 uuid 2a4c perm 0x01
[00:00:00.501,861] <dbg> bt_gatt.gatt_register: attr 0x20006a0c handle 0x0018 uuid 2a4c perm 0x01
[00:00:00.501,861] <dbg> bt_gatt.gatt_register: attr 0x20006a20 handle 0x0019 uuid 2a4c perm 0x01
[00:00:00.501,892] <dbg> bt_gatt.gatt_register: attr 0x20006a34 handle 0x001a uuid 2a4c perm 0x01
[00:00:00.501,922] <dbg> bt_gatt.gatt_register: attr 0x20006a48 handle 0x001b uuid 2a4c perm 0x01
[00:00:00.501,922] <dbg> bt_gatt.gatt_register: attr 0x20006a5c handle 0x001c uuid 2a4c perm 0x01
[00:00:00.501,953] <dbg> bt_gatt.gatt_register: attr 0x20006a70 handle 0x001d uuid 2a4c perm 0x10
[00:00:00.501,983] <dbg> bt_gatt.gatt_register: attr 0x20006a84 handle 0x001e uuid 2a4c perm 0x03
[00:00:00.501,983] <dbg> bt_gatt.gatt_register: attr 0x20006a98 handle 0x001f uuid 2a4c perm 0x01
[00:00:00.502,014] <dbg> bt_gatt.gatt_register: attr 0x20006aac handle 0x0020 uuid 2a4c perm 0x01
[00:00:00.502,044] <dbg> bt_gatt.gatt_register: attr 0x20006ac0 handle 0x0021 uuid 2a4c perm 0x02
settings_commit(): name:X
Advertising successfully started0c end 0x0016 new_start 0x0017 new_end 0x0021
settings_str_from_bytes(): buf_len=13, vp_len=7, 0x1 0xd0 0x3a 0x41 0x4e 0xe2 0xfd
BASE64_ENCODE_SIZE(vp_len)=13
 base64_encode(): slen=7 0x1 0xd0 0x3a 0x41 0x4e 0xe2 0xfd
after encode: enc_len=12
settings_save_one: key=bt/id, val=AdA6QU7i/Q== -> saving

[00:00:00.537,414] <dbg> bt_settings.commit:
[00:00:00.537,689] <inf> bt_hci_core.bt_dev_show_info: Identity: fd:e2:4e:41:3a:d0 (random)
[00:00:00.537,719] <inf> bt_hci_core.bt_dev_show_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0x05f1
[00:00:00.537,719] <inf> bt_hci_core.bt_dev_show_info: LMP: version 5.0 (0x09) subver 0xffff
[00:00:00.538,665] <dbg> bt_gatt.sc_process: start 0x000c end 0x0021
[00:00:00.541,290] <dbg> bt_settings.save_id: Saving ID addr as value P5

Connected de:08:c8:bc:cd:fa (random)

[00:00:15.359,100] <dbg> bt_gatt.bt_gatt_connected: conn 0x20001b7c
[00:00:15.397,705] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0001 offset 0 length 2
[00:00:15.397,735] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0008 offset 0 length 2
[00:00:15.397,766] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x000c offset 0 length 2
[00:00:15.450,195] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0013 offset 0 length 2
[00:00:15.450,225] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0017 offset 0 length 2
[00:00:15.510,192] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0002 offset 0 length 5
[00:00:15.510,223] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0004 offset 0 length 5
[00:00:15.525,268] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0006 offset 0 length 5
[00:00:15.540,252] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0003 offset 0 length 14
[00:00:15.555,236] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0005 offset 0 length 2
[00:00:15.570,251] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0007 offset 0 length 8
Passkey for de:08:c8:bc:cd:fa (random): 651280read: handle 0x0003 offset 0 length 14

settings_str_from_bytes(): buf_len=105, vp_len=78, 0x10 0x11 0x20 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x
0 0x0 0x0 0x9c 0xf4 0xdb 0x5f 0x4c 0x0 0x3b 0x82 0x5d 0xda 0x2e 0xac 0x95 0x82 0x22 0x34 0x0 0x0 0x0 0x0 0x0 0x0 0x0
 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
 BASE64_ENCODE_SIZE(vp_len)=105
 base64_encode(): slen=780x10 0x11 0x20 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x9c 0xf4 0xdb 0x5f 0x4c 0x0 0x3
b 0x82 0x5d 0xda 0x2e 0xac 0x95 0x82 0x22 0x34 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0
x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0
x0 0x0
after encode: enc_len=104
settings_save_one: key=bt/keys/de08c8bccdfa1, val=EBEgAAAAAAAAAAAAAACc9NtfTAA7gl3aLqyVgiI0AAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -> saving
Security changed: de:08:c8:bc:cd:fa (random) level 4

[00:00:29.416,961] <dbg> bt_settings.bt_settings_encode_key: Encoded path

GATT DISCOVERY ON HID SERVICE

[00:00:38.017,547] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0018 offset 0 length 5
[00:00:38.017,578] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001a offset 0 length 5
[00:00:38.077,636] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001c offset 0 length 5
[00:00:38.077,667] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0020 offset 0 length 5
[00:00:38.137,573] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x0019 offset 0 length 4
[00:00:38.197,570] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001b offset 0 length 22
[00:00:38.257,568] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001d offset 0 length 0
[00:00:38.527,587] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001e offset 0 length 2
[00:00:38.587,585] <dbg> bt_gatt.bt_gatt_attr_read: handle 0x001f offset 0 length 2

DISCONNECT

ccc_save: attr 1 attr is not CCC
ccc_save: attr 2 attr is not CCC
ccc_save: attr 3 attr is not CCC
ccc_save: attr 4 attr is not CCC
ccc_save: attr 5 attr is not CCC
ccc_save: attr 6 attr is not CCC
ccc_save: attr 7 attr is not CCC
ccc_save: attr 8 attr is not CCC
ccc_save: attr 9 attr is not CCC
ccc_save: attr 10 attr is not CCC
ccc_save: attr 11 save count 0ccc_find_cfg() cfg_len = 3
no cfg for the peer
ccc_save: attr 12 attr is not CCC
ccc_save: attr 13 attr is not CCC
ccc_save: attr 14 attr is not CCC
ccc_save: attr 15 attr is not CCC
ccc_save: attr 16 attr is not CCC
ccc_save: attr 17 attr is not CCC
ccc_save: attr 18 attr is not CCC
ccc_save: attr 19 attr is not CCC
ccc_save: attr 20 attr is not CCC
ccc_save: attr 21 attr is not CCC
ccc_save: attr 22 save count 0ccc_find_cfg() cfg_len = 3
no cfg for the peer
ccc_save: attr 23 attr is not CCC
ccc_save: attr 24 attr is not CCC
ccc_save: attr 25 attr is not CCC
ccc_save: attr 26 attr is not CCC
ccc_save: attr 27 attr is not CCC
ccc_save: attr 28 attr is not CCC
ccc_save: attr 29 attr is not CCC
ccc_save: attr 30 save count 0ccc_find_cfg() cfg_len = 3
no cfg for the peer
ccc_save: attr 31 attr is not CCC
ccc_save: attr 32 attr is not CCC
ccc_save: attr 33 attr is not CCC
save.count=0
settings_str_from_bytes(): buf_len=257, buf=��buf in hex: vp_len=0, BASE64_ENCODE_SIZE(vp_len)=5
 base64_encode(): slen=0
after encode: enc_len=0
bt_gatt_store_ccc: str = ��val = ��id = 0
save.count=0save_store[0] h:13000 v:8192
save_store[1] h:1 v:0
save_store[2] h:5213 v:0
save_store[3] h:10777 v:0
save_store[4] h:0 v:0
save_store[5] h:13000 v:8192
save_store[6] h:1 v:0
save_store[7] h:20943 v:8192
save_store[8] h:65528 v:65535
save_store[9] h:53195 v:1
save_store[10] h:256 v:0
save_store[11] h:0 v:0
save_store[12] h:6393 v:8192
save_store[13] h:52731 v:1
save_store[14] h:3 v:0
save_store[15] h:19499 v:0
save_store[16] h:10 v:0
save_store[17] h:21044 v:2560
save_store[18] h:21076 v:8192
save_store[19] h:0 v:0
save_store[20] h:3633 v:0
save_store[21] h:21044 v:8192
save_store[22] h:0 v:0
save_store[23] h:3915 v:0
save_store[24] h:0 v:0
save_store[25] h:16435 v:61423
save_store[26] h:1 v:0
save_store[27] h:27848 v:8192
save_store[28] h:60665 v:1
save_store[29] h:16527 v:0
save_store[30] h:15728 v:8192
save_store[31] h:21020 v:8192
save_store[32] h:2 v:0
save_store[33] h:15568 v:8192
save_store[34] h:21088 v:8192
save_store[35] h:12785 v:0
save_store[36] h:15568 v:8192
save_store[37] h:21096 v:8192
save_store[38] h:2 v:0
save_store[39] h:13217 v:0
save_store[40] h:2 v:0
save_store[41] h:16144 v:8192
save_store[42] h:21120 v:8192
save_store[43] h:12785 v:0
save_store[44] h:16144 v:8192
save_store[45] h:21128 v:8192
save_store[46] h:2 v:0
save_store[47] h:13217 v:0
str[0]=d0
settings_save_one: key=bt/ccc/de08c8bccdfa1, val=��> saving
Disconnected from de:08:c8:bc:cd:fa (random) (reason 19)

[00:00:55.627,502] <dbg> bt_gatt.bt_gatt_disconnected: conn 0x20001b7c
[00:00:55.657,257] <dbg> bt_settings.bt_settings_encode_key: Encoded path bt/ccc/de08c8bccdfa1
[00:00:55.662,292] <dbg> bt_gatt.bt_gatt_store_ccc: Stored CCCs for de:08:c8:bc:cd:fa (random) (bt/ccc/de08c8bccdfa1
) val

RESET BOARD

***** Booting Zephyr OS zephyr-v1.13.0-2068-g3984361 *****
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f1c handle 0x0001 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f30 handle 0x0002 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f44 handle 0x0003 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f58 handle 0x0004 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f6c handle 0x0005 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f80 handle 0x0006 uuid 2a05 perm 0x01
[00:00:00.000,000] <dbg> bt_gatt.gatt_register: attr 0x20006f94 handle 0x0007 uuid 2a05 perm 0x01
[00:00:00.000,030] <dbg> bt_gatt.gatt_register: attr 0x20006fb4 handle 0x0008 uuid 2a05 perm 0x01
[00:00:00.000,061] <dbg> bt_gatt.gatt_register: attr 0x20006fc8 handle 0x0009 uuid 2a05 perm 0x01
[00:00:00.000,061] <dbg> bt_gatt.gatt_register: attr 0x20006fdc handle 0x000a uuid 2a05 perm 0x00
[00:00:00.904,479] <dbg> bt_gatt.gatt_register: attr 0x20006ff0 handle 0x000b uuid 2a50 perm 0x03
[00:00:00.904,510] <dbg> bt_gatt.gatt_register: attr 0x20006c1c handle 0x000c uuid 2a50 perm 0x01
[00:00:00.904,541] <dbg> bt_gatt.gatt_register: attr 0x20006c30 handle 0x000d uuid 2a50 perm 0x01
[00:00:00.904,541] <dbg> bt_gatt.gatt_register: attr 0x20006c44 handle 0x000e uuid 2a50 perm 0x01
[00:00:00.904,571] <dbg> bt_gatt.gatt_register: attr 0x20006c58 handle 0x000f uuid 2a50 perm 0x01
[00:00:00.904,571] <dbg> bt_gatt.gatt_register: attr 0x20006c6c handle 0x0010 uuid 2a50 perm 0x01
[00:00:00.904,602] <dbg> bt_gatt.gatt_register: attr 0x20006c80 handle 0x0011 uuid 2a50 perm 0x01
[00:00:00.904,632] <dbg> bt_gatt.gatt_register: attr 0x20006c94 handle 0x0012 uuid 2a50 perm 0x01
[00:00:00.904,663] <dbg> bt_settings.bt_settings_init:
[00:00:00.906,677] <inf> bt_hci_core.hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.906,677] <inf> bt_hci_core.hci_vs_init: HW Variant: nRF52x (0x0002)
[00:00:00.906,677] <inf> bt_hci_core.hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 1.13 Build
Bluetooth initialized

[00:00:00.953,948] <dbg> bt_gatt.gatt_register: attr 0x20006b5c handle 0x0014 uuid 2a4c perm 0x01
[00:00:00.953,979] <dbg> bt_gatt.gatt_register: attr 0x20006b70 handle 0x0015 uuid 2a4c perm 0x01
[00:00:00.953,979] <dbg> bt_gatt.gatt_register: attr 0x20006b84 handle 0x0016 uuid 2a4c perm 0x03
[00:00:00.954,010] <dbg> bt_gatt.update_range: start 0x000c end 0x0012 new_start 0x0013 new_end 0x0016
[00:00:00.954,040] <dbg> bt_gatt.gatt_register: attr 0x200069f8 handle 0x0017 uuid 2a4c perm 0x01
[00:00:00.954,071] <dbg> bt_gatt.gatt_register: attr 0x20006a0c handle 0x0018 uuid 2a4c perm 0x01
[00:00:00.954,071] <dbg> bt_gatt.gatt_register: attr 0x20006a20 handle 0x0019 uuid 2a4c perm 0x01
[00:00:00.954,101] <dbg> bt_gatt.gatt_register: attr 0x20006a34 handle 0x001a uuid 2a4c perm 0x01
[00:00:00.954,132] <dbg> bt_gatt.gatt_register: attr 0x20006a48 handle 0x001b uuid 2a4c perm 0x01
[00:00:00.954,132] <dbg> bt_gatt.gatt_register: attr 0x20006a5c handle 0x001c uuid 2a4c perm 0x01
[00:00:00.954,162] <dbg> bt_gatt.gatt_register: attr 0x20006a70 handle 0x001d uuid 2a4c perm 0x10
[00:00:00.954,193] <dbg> bt_gatt.gatt_register: attr 0x20006a84 handle 0x001e uuid 2a4c perm 0x03
[00:00:00.954,193] <dbg> bt_gatt.gatt_register: attr 0x20006a98 handle 0x001f uuid 2a4c perm 0x01
[00:00:00.954,223] <dbg> bt_gatt.gatt_register: attr 0x20006aac handle 0x0020 uuid 2a4c perm 0x01
[00:00:00.954,254] <dbg> bt_gatt.gatt_register: attr 0x20006ac0 handle 0x0021 uuid 2a4c perm 0x02
settings_set_value(): name: bt/id, val_str: AdA6QU7i/Q==00c end 0x0016 new_start 0x0017 new_end 0x0021

found handler bt

argc 1 argv[0] id argv[1] (null) val AdA6QU7i/Q==

settings_set_value(): name: bt/keys/de08c8bccdfa1, val_str: EBEgAAAAAAAAAAAAAACc9NtfTAA7gl3aLqyVgiI0AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

found handler bt

argc 2 argv[0] keys argv[1] de08c8bccdfa1 val EBEgAAAAAAAAAAAAAACc9NtfTAA7gl3aLqyVgiI0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

settings_set_value(): name: bt/ccc/de08c8bccdfa1, val_str: ��
found handler bt

argc 2 argv[0] ccc argv[1] de08c8bccdfa1 val ��
ASSERTION FAIL [rc == 0] @ /home/fi/ncs/zephyr/subsys/settings/src/settings_store.c:50:
        set-value operation failure

Build environment (please complete the following information):

Qbicz commented 5 years ago

@JoeHut is it similar to what you have seen?

Qbicz commented 5 years ago

@nvlsianpu @Vudentz @jhedberg

Olivier-ProGlove commented 5 years ago

You need to set LOG_BT_SETTINGS_CCC_STORE_ON_WRITE=1. But yes that is the same issue as we have.

Olivier-ProGlove commented 5 years ago

Be aware of this issue I am working on: https://github.com/zephyrproject-rtos/zephyr/issues/11409#issuecomment-440630063

Qbicz commented 5 years ago

@Olivier-ProGlove Thanks for the link. BT_SETTINGS_CCC_STORE_ON_WRITE fixes the problem in most cases, but not when you perform the discovery but don't subscribe to any notification. There is no CCC write then and this bug reveals.

Olivier-ProGlove commented 5 years ago

You are right. It is also true we saw this issue even after enabling LOG_BT_SETTINGS_CCC_STORE_ON_WRITE=1 but much less frequently.