Skip to content

feat(csharp): add proposed change for Thrift library supports of interleaved async calls - #99

Draft
birschick-bq wants to merge 20 commits into
adbc-drivers:mainfrom
birschick-bq:dev/v-birschick/thrift-async-call-support
Draft

birschick-bq wants to merge 20 commits into
adbc-drivers:mainfrom
birschick-bq:dev/v-birschick/thrift-async-call-support

Conversation

@birschick-bq

@birschick-bq birschick-bq commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

What's Changed

This change is a WIP that demonstrates how to use the changes proposed in THRIFT-5830: THttpTransport can now be used in interleaved async calls- #3930. This is to resolve the issue raised in THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception

As the code in TCLIService was originally generated - we must decide if we want the manual updates I am proposing here - or wait for the generator to produce a compatible solution.


This pull request adds a comprehensive new test class for the TCLIService.Client in the HiveServer2 Thrift driver. The tests cover protocol factory behavior, transport management, and legacy constructor compatibility, ensuring robust client interactions and resource handling.

New Test Coverage for Thrift Client

  • Added TCLIServiceClientTests class in TCLIServiceClientTests.cs with multiple [Fact] tests to verify the behavior of TCLIService.Client regarding protocol factory usage, transport lifecycle, and legacy constructor support.

Protocol and Transport Management

  • Verified that the protocol factory is called for each RPC with distinct transports, ensuring per-call resource isolation.
  • Confirmed that both successful and failed RPCs properly dispose of per-call transports and protocols, preventing resource leaks.
  • Ensured that caller-owned, non-provider transports remain usable across multiple calls, validating correct ownership semantics.

Legacy Constructor Support

  • Tested that both legacy single-protocol and input/output protocol constructors support multiple calls, maintaining backward compatibility.

Test Utilities

  • Introduced TrackingProtocolFactory and SharedTransport helper classes to facilitate protocol and transport tracking within the tests.

Reviewers: recommend to hide whitespace changes as it was reformatted to use standard 4-space indentation.

@birschick-bq birschick-bq changed the title feat(csharp): This is a WIP for Thrift library supports of async calls feat(csharp): add proposed change for Thrift library supports of interleaved async calls Sep 22, 2026
@CurtHagenlocher

Copy link
Copy Markdown
Collaborator

Neat! The autogenerated files have been edited for multiple reasons; a key one is performance. So I don't think we can get away from hand-editing entirely (e.g. to load Arrow arrays directly), but we could look at changing the stock Thrift compiler to accommodate some of our other quirks.

birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 22, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 23, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 24, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 25, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 25, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 25, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT 5.6 Luna
Co-authored-by: GPT-6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 25, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT-5.6 Luna
Co-authored-by: GPT-6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
birschick-bq pushed a commit to birschick-bq/thrift that referenced this pull request Sep 25, 2026
Client: netstd

Handles
- [THRIFT-5830: Using THttpTransport using interleaved asynchronous calls may throw exception](https://issues.apache.org/jira/browse/THRIFT-5830)

This pull request introduces a new per-call transport mechanism for `THttpTransport`, allowing each logical Thrift call to use a distinct HTTP request/response cycle. This improves resource management, error isolation, and concurrency for HTTP-based Thrift clients. The implementation includes a new interface, a per-call transport class, and comprehensive tests to verify correct behavior and resource disposal.

Proposed changes to the code generator can be found in this PR: [feat(csharp): add proposed change for Thrift library supports of interleaved async calls](adbc-drivers/hiveserver2#99 (comment))

* Added the `ITPerCallTransportProvider` interface to define a standard method for creating per-call transports. (`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages request/response streams for a single Thrift call, ensuring proper disposal and isolation from the parent transport. (`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and provide the `CreatePerCallTransportAsync` method, which returns a new `THttpPerCallTransport` for each call. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`) [[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35) [[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)

* Added an internal `SendAsync` method to `THttpTransport` to handle sending the request stream and returning the HTTP response, with robust exception handling and resource cleanup. (`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)

* Added comprehensive unit tests to `THttpTransportTests` to verify per-call transport behavior, including resource disposal, error handling, concurrency, and protocol factory integration. (`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)

These changes collectively improve the reliability, testability, and scalability of HTTP-based Thrift transports by supporting per-call isolation and robust resource management.

Co-authored-by: Claude Sonnet 5
Co-authored-by: GPT-5.6 Luna
Co-authored-by: GPT-6 Luna
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants