DiceDB / dice

DiceDB is an in-memory real-time database with SQL-based reactivity. It is hyper-optimized for building and scaling truly real-time applications on modern hardware while being a drop-in replacement for Redis.
https://dicedb.io/
Other
4.05k stars 503 forks source link

Handle different failure/error scenarios during socket reads. #225

Open soumya-codes opened 1 month ago

soumya-codes commented 1 month ago

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.

ayushsatyam146 commented 1 month ago

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

JyotinderSingh commented 1 month ago

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

Assigned

AshwinKul28 commented 2 weeks ago

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.

arpitbbhayani commented 6 days ago

Removing the assignment due to inactivity.

jayantpranjal0 commented 6 days ago

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

deep-adeshraa commented 5 days ago

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