fivenines

Practice / target 80%

Client Connection Lifecycle Practice

01

A client sends one command split across three TCP reads. Which object remembers the unfinished command, and why should the database not know about it?

intro

Scenario

A client's command arrives fragmented across multiple TCP reads on a busy server.

02

A socket write accepts only 10 bytes of a 100-byte reply. What state must be preserved before the event loop returns?

intro

Scenario

The server is flushing a large reply and the socket accepts only part of it before returning would-block.

03

Compare a normal client, a transaction-building client, and a subscribed client. Which dispatch decisions change for each?

applied

Scenario

Three connections are open, one normal, one mid-MULTI, and one subscribed to a channel.

04

A disconnected Pub/Sub client still appears in a channel subscriber set. What symptom will this cause later?

applied

Scenario

A Pub/Sub client's connection died, but its cleanup never removed it from the channel's subscriber set.

05

Which cleanup steps are mandatory when closing a client with pending output and Pub/Sub subscriptions?

advanced

Scenario

You are writing the teardown path for a client that has pending output, watched keys, and active subscriptions.