----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/1998/ -----------------------------------------------------------
Review request for Default. Repository: gem5 Description ------- Fixes a race condition in the socket listen function. gem5 makes the incorrect assumption that by "binding" a socket, it effectively has allocated a port. Linux only allocates ports once you call listen on the given socket, not when you call bind. So even if the port was free when bind was called, another process (gem5 instance) could race in between the bind & listen calls and steal the port. In the current code, if the call to bind fails due to the port being in use (EADDRINUSE), gem5 retries for a different port. However if listen fails, gem5 just panics. The fix is testing the return value of listen and re-trying if it was due to EADDRINUSE. Diffs ----- src/base/socket.cc a317086a3e19 Diff: http://reviews.gem5.org/r/1998/diff/ Testing ------- Have been running with this patch since April, eliminated the race condition. Thanks, Mitch Hayenga _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
