Closes https://github.com/espressif/esp-idf/issues/3062 (cherry picked from commit 27e00cf7aa)
27e00cf7aa