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

The IDLE based eviction is not supported for HTTP/2 connections #7309

Open
TharmiganK opened this issue Oct 29, 2024 · 0 comments · May be fixed by ballerina-platform/module-ballerina-http#2277
Assignees
Labels
module/http Priority/High Team/PCM Protocol connector packages related issues Type/Bug

Comments

@TharmiganK
Copy link
Contributor

Description

The HTTP client have the following record to configure the IDLE based connection eviction:

public type PoolConfiguration record {|
    # Max active connections per route(host:port). Default value is -1 which indicates unlimited.
    int maxActiveConnections = maxActiveConnections;
    # Maximum number of idle connections allowed per pool.
    int maxIdleConnections = maxIdleConnections;
    # Maximum amount of time (in seconds), the client should wait for an idle connection before it sends an error when the pool is exhausted
    decimal waitTime = waitTime;
    ...
    # Minimum evictable time for an idle connection in seconds. Default value is 5 minutes
    decimal minEvictableIdleTime = minEvictableIdleTime;
    # Time between eviction runs in seconds. Default value is 30 seconds
    decimal timeBetweenEvictionRuns = timeBetweenEvictionRuns;
    ...
|};

But these options are not applied for the HTTP/2 connections. Currently HTTP/2 connections only support STALE based eviction(based on the GO_AWAY frames).

Steps to Reproduce

Service:

import ballerina/http;

service /app on new http:Listener(9090) {

    resource function get api() returns string {
        return "Hello, World!";
    }
}

Client:

import ballerina/http;
import ballerina/lang.runtime;

http:PoolConfiguration poolConfig = {
    minEvictableIdleTime: 5,
    timeBetweenEvictionRuns: 5
};

final http:Client clientEP = check new ("http://localhost:9090/app", poolConfig = poolConfig);

public function main() returns error? {
    http:Response _ = check clientEP->/api;
    runtime:sleep(2);

    http:Response _ = check clientEP->/api;
    runtime:sleep(15);

    // Expects a new connection to be made since the connection is IDLE for the configured time
    http:Response _ = check clientEP->/api;
}

Run the service and client files. Enable trace logs in the client side and you can notice that the same connection is used for the third request as well.

Version

Ballerina SwanLake Update 10(2201.10.0)

Environment Details (with versions)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Priority/High Team/PCM Protocol connector packages related issues Type/Bug
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant