Calloc bug narrowed down, probably the socket being closed. Only affecting Linux.