dice icon indicating copy to clipboard operation
dice copied to clipboard

Handle different failure/error scenarios during socket reads.

Open soumya-codes opened this issue 1 year ago • 7 comments

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:

  1. EOF (peer closed connection): Detected by comparing the error to io.EOF. (Partially addressed)
  2. Zero-byte read: A read of 0 bytes without an error. In case of IO multiplexed scenario this means a closed connection.
  3. Timeout: Check if net.Error and checking if it's a timeout.
  4. Connection closed locally: Detect by checking for syscall.EBADF or os.ErrClosed.
  5. Connection reset: Detect by checking for syscall.ECONNRESET.
  6. 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.

soumya-codes avatar Aug 03 '24 15:08 soumya-codes

@JyotinderSingh I would like to work on this issue. Please assign it to me.

ayushsatyam146 avatar Aug 04 '24 16:08 ayushsatyam146

@JyotinderSingh I would like to work on this issue. Please assign it to me.

Assigned

JyotinderSingh avatar Aug 04 '24 16:08 JyotinderSingh

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.

AshwinKul28 avatar Aug 25 '24 18:08 AshwinKul28

Removing the assignment due to inactivity.

arpitbbhayani avatar Sep 08 '24 12:09 arpitbbhayani

I would like to work on this. @arpitbbhayani can you assign this to me?

jayantpranjal0 avatar Sep 08 '24 13:09 jayantpranjal0

If this is pending, I would like to work on it

deep-adeshraa avatar Sep 08 '24 15:09 deep-adeshraa

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.

ayushsatyam146 avatar Sep 19 '24 13:09 ayushsatyam146

@AshwinKul28 @soumya-codes @JyotinderSingh can you please take a look

ayushsatyam146 avatar Sep 23 '24 10:09 ayushsatyam146