Backported infinite read() on socket prevention from master