Closes https://github.com/espressif/esp-idf/issues/3011 (cherry picked from commit 60b5cdde20)
60b5cdde20