Thanks for the report and guidelines to reproduce it.
I pushed a patch for it in master branch. Can you try it? If all ok, then I will backport.
Was this case how you discovered it? Or was another scenario? I want to see if we should look at other parts of code.