After done some testing, I found a bug in the patch. If more requests werepushed while we release the lock, num_requests could not be set to zero.
Here is a fixed version.
-- Best regards,Maxim Orlov.