I'm getting a very similar issue, at least for me it appears to be an issue with multi-threaded code. I've tried writing my code both with and without threading and I only have this issue on the threaded version. I'll try to put together an MCVE if I have time so that hopefully this can get fixed.