nsdispatch(3) internally calls nss_configure() to see whether nsswitch.conf needs to be parsed. nss_configure() is called with the nss read lock held. It attempts to acquire the configuration mutex (i.e. trylock), and just returns 0 if it can't acquire it, so it continues with the lookup. In particular, this thread races with the thread holding the configuration mutex as it parses nsswitch.conf. This race is exacerbated by the fact that the thread holding the configuration mutex has to acquire the nss write lock before it can parse nsswitch.conf.
This can cause spurious lookup failures, since the first thread above may have to fall back to the default database sources instead of the sources specified in nsswitch.conf.
The fix is to unconditionally acquire the configuration mutex, dropping it immediately if another thread parsed nsswitch.conf while we were blocked.