I have created a load generator to test a server, written in Python. The load generator creates a socket, connects to the server socket, requests a file, then disconnects. The load generator runs as expected when I instantiate < ~300 threads, but when I instantiate any more past that, I get the following errors client-side:
- [Errno 32] Broken pipe on
sendall
- [Errno 54] Connection reset by peer on
recv
occasionally,
- [Errno 41] Protocol wrong type for socket
Why is the server closing its read side of the socket prematurely, forcing the client-side to get a broken pipe error? I'm assuming the other errors are related to this.
I have read another thread stating that this might be due to lack of memory client-side because so many threads are instantiated: How to fix java.net.SocketException: Broken pipe?
I'm looking for an understanding of why these errors are occurring when many threads are instantiated, but do not occur when fewer threads are instantiated, and how to narrow down the problem and fix it.