Fix deadlock caused by fast producer / slow consumer.