apple / apple/servicetalk

Handle cancelation after ConnectionFactory creates a new connection

Open
#1,010 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1k
Forks
229
Avg merge
23h 23m
Merged PRs (30d)
16

Description

`ConnectioFactoryFilter`(s) may already create a new connection but work with it before emitting downstream. See [ProxyConnectConnectionFactoryFilter](https://github.com/apple/servicetalk/blob/master/servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/ProxyConnectConnectionFactoryFilter.java) as an example. When cancel is received after a new connection is created we need to clean up this resource.

However, `cancel()` can come after a success, we really do not know if the cancel has come due to the operation was canceled by the user or due to some operators sending a cancel for the previous source when they move on to the next source (eg: `concat()`). Connection lifetime is anyways a problem in such situation and is out of the context of each filter implementation.

See https://github.com/apple/servicetalk/pull/1002#discussion_r404538544 for more context.

Contributor guide

Open the contributing guide

Research direction

Start with ProxyConnectConnectionFactoryFilter.java and the linked pull-request discussion to understand when a new connection is created and when downstream emission occurs. Trace cancellation after connection creation, including cancellation after success, and establish the intended connection-lifetime behavior before identifying the cleanup and regression tests needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.