fix race in socket code

Merge request reports