Add test for #145
Add thread analysis for sporadic test failure