Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[protocolv2] Ignore follow up messages to a stream after server aborts it #204

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

masad-frost
Copy link
Member

Why

When the server aborts a stream (due to invalid request or explicit abort) the client send more messages before it gets the abort. We should make sure this doesn't lead to errors and unnecessary follow up responses.

What changed

Keep an LRU of aborted streams, if a new message comes in for a stream in our set, we simply ignore the message.

@masad-frost masad-frost requested a review from a team as a code owner June 15, 2024 20:03
@masad-frost masad-frost requested review from Monkatraz and removed request for a team June 15, 2024 20:03
@masad-frost masad-frost mentioned this pull request Jun 15, 2024
32 tasks
Copy link
Contributor

@Monkatraz Monkatraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

router/server.ts Outdated Show resolved Hide resolved
router/server.ts Outdated Show resolved Hide resolved
Comment on lines +791 to +823
add(item: string) {
if (this.items.has(item)) {
this.items.delete(item);
} else if (this.items.size >= this.maxItems) {
const first = this.items.values().next();
if (!first.done) {
this.items.delete(first.value);
}
}
this.items.add(item);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels elegant, nice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty :)

__tests__/abort.test.ts Show resolved Hide resolved
router/server.ts Outdated Show resolved Hide resolved
router/server.ts Outdated Show resolved Hide resolved
.replit Show resolved Hide resolved
Base automatically changed from fm-invalid-requests to protocolv2 June 20, 2024 17:39
@masad-frost masad-frost merged commit 12f9f33 into protocolv2 Jun 20, 2024
3 checks passed
@masad-frost masad-frost deleted the fm-tombstones branch June 20, 2024 17:46
masad-frost added a commit that referenced this pull request Jun 20, 2024
…s it (#204)

## Why

When the server aborts a stream (due to invalid request or explicit
abort) the client send more messages before it gets the abort. We should
make sure this doesn't lead to errors and unnecessary follow up
responses.

## What changed

Keep an LRU of aborted streams, if a new message comes in for a stream
in our set, we simply ignore the message.
masad-frost added a commit that referenced this pull request Jun 24, 2024
…s it (#204)

## Why

When the server aborts a stream (due to invalid request or explicit
abort) the client send more messages before it gets the abort. We should
make sure this doesn't lead to errors and unnecessary follow up
responses.

## What changed

Keep an LRU of aborted streams, if a new message comes in for a stream
in our set, we simply ignore the message.
masad-frost added a commit that referenced this pull request Jun 24, 2024
…s it (#204)

## Why

When the server aborts a stream (due to invalid request or explicit
abort) the client send more messages before it gets the abort. We should
make sure this doesn't lead to errors and unnecessary follow up
responses.

## What changed

Keep an LRU of aborted streams, if a new message comes in for a stream
in our set, we simply ignore the message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants