Handle different failure/error scenarios during socket reads.
A system as versatile as a Database needs to handles large number of connections under different failure conditions and high contention scenarios. Such system can experience multiple types of connection errors/issues. To ensure robustness of the system and better observability, we should identify and handle these error/issues and ensure a well defined behaviour. We can further breakdown on which errors need special handling and which ones can be treated generically.
Here are a few scenarios that we should handle while reading from a socket:
- EOF (peer closed connection): Detected by comparing the error to io.EOF. (Partially addressed)
- Zero-byte read: A read of 0 bytes without an error. In case of IO multiplexed scenario this means a closed connection.
- Timeout: Check if net.Error and checking if it's a timeout.
- Connection closed locally: Detect by checking for syscall.EBADF or os.ErrClosed.
- Connection reset: Detect by checking for syscall.ECONNRESET.
- Other errors: Any other errors are reported as general read errors.
Note: Similarly, we need to handle different error/failure scenarios for connections handling and socket writes.
@JyotinderSingh I would like to work on this issue. Please assign it to me.
@JyotinderSingh I would like to work on this issue. Please assign it to me.
Assigned
Hey @ayushsatyam146 Do you have any updates on this? If you have any blockers lets discuss this over the discord. Thanks a lot for contributing.
Removing the assignment due to inactivity.
I would like to work on this. @arpitbbhayani can you assign this to me?
If this is pending, I would like to work on it
Hi @AshwinKul28 I see this issue is partially addressed by another contributor. It would be great if you can point me out to that PR. It would help me to get a better understanding.
@AshwinKul28 @soumya-codes @JyotinderSingh can you please take a look