On Wed, Nov 30, 2016 at 03:28:23PM -0800, Brandon Williams wrote: > So I couldn't find a race condition in the code. I tracked the problem > to grep_source_load_file which attempts to run lstat on the file so that > it can read it into a buffer. The lstat call fails with ENOENT (which > conveniently is skipped by the if statement which calls error_errno). So > for some reason the file cannot be found and read into memory resulting > in nothing being grep'ed for that particular file (since the buffer is > NULL). That's definitely weird. Is it possible that any of the underlying calls from another thread are using chdir()? I think realpath() make do that behind the scenes, and there may be others. A full strace from a failing case would be interesting reading. In theory we should be able to get that by running the stress script for long enough. :) -Peff