Fix deadlock when the decoder return an error.