[
https://issues.apache.org/jira/browse/THRIFT-5830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895003#comment-17895003
]
Jens Geyer commented on THRIFT-5830:
------------------------------------
Thanks! Could you send a pull request please?
> Using THttpTransport using interleaved asynchronous calls may throw exception
> -----------------------------------------------------------------------------
>
> Key: THRIFT-5830
> URL: https://issues.apache.org/jira/browse/THRIFT-5830
> Project: Thrift
> Issue Type: Bug
> Components: netstd - Library
> Affects Versions: 0.21.0
> Environment: See this PR to remove interleaved asynchronous calls to
> work-around the issue.
> [fix(csharp/src/Drivers/Apache): remove interleaved async look-ahead code by
> birschick-bq · Pull Request #2273 ·
> apache/arrow-adbc|https://github.com/apache/arrow-adbc/pull/2273]
> Reporter: Bruce Irschick
> Priority: Major
>
> When using the THttpTransport, interleaved asynchronous calls can cause the
> following exception:
> {code:java}
> System.AggregateException : One or more errors occurred. (Couldn't connect to
> server: System.Net.Http.HttpRequestException: Error while copying content to
> a stream.
> ---> System.ObjectDisposedException: Cannot access a closed Stream.{code}
>
> Essentially, the *THttpTransport._outputStream* can get disposed while
> another asynchronous call is running.
> This is due to allocating the _outputStream at the class level. The stream
> should be allocated on a call-by-call basis.
>
> {code:java}
> Apache.Arrow.Adbc.Tests.Drivers.Apache.Spark.DriverTests.CanExecuteUpdate
> Source: DriverTests.cs line 90
> Duration: 1.8 sec
> Message:
> System.AggregateException : One or more errors occurred. (Couldn't connect to
> server: System.Net.Http.HttpRequestException: Error while copying content to
> a stream.
> ---> System.ObjectDisposedException: Cannot access a closed Stream.
> at System.IO.MemoryStream.CopyToAsync(Stream destination, Int32
> bufferSize, CancellationToken cancellationToken)
> at System.Net.Http.StreamToStreamCopy.CopyAsync(Stream source, Stream
> destination, Int32 bufferSize, Boolean disposeSource, CancellationToken
> cancellationToken)
> --- End of stack trace from previous location ---
> at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask
> copyTask)
> --- End of inner exception stack trace ---
> at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask
> copyTask)
> at
> System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage
> request, HttpContentWriteStream stream, Boolean async, CancellationToken
> cancellationToken)
> at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at
> System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage
> request, Boolean async, Boolean doRequestAuth, CancellationToken
> cancellationToken)
> at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage
> request, HttpCompletionOption completionOption, CancellationTokenSource cts,
> Boolean disposeCts, CancellationTokenSource pendingRequestsCts,
> CancellationToken originalCancellationToken)
> at Thrift.Transport.Client.THttpTransport.FlushAsync(CancellationToken
> cancellationToken))
> ---- Thrift.Transport.TTransportException : Couldn't connect to server:
> System.Net.Http.HttpRequestException: Error while copying content to a stream.
> ---> System.ObjectDisposedException: Cannot access a closed Stream.
> at System.IO.MemoryStream.CopyToAsync(Stream destination, Int32
> bufferSize, CancellationToken cancellationToken)
> at System.Net.Http.StreamToStreamCopy.CopyAsync(Stream source, Stream
> destination, Int32 bufferSize, Boolean disposeSource, CancellationToken
> cancellationToken)
> --- End of stack trace from previous location ---
> at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask
> copyTask)
> --- End of inner exception stack trace ---
> at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask
> copyTask)
> at
> System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage
> request, HttpContentWriteStream stream, Boolean async, CancellationToken
> cancellationToken)
> at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at
> System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage
> request, Boolean async, Boolean doRequestAuth, CancellationToken
> cancellationToken)
> at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,
> Boolean async, CancellationToken cancellationToken)
> at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage
> request, HttpCompletionOption completionOption, CancellationTokenSource cts,
> Boolean disposeCts, CancellationTokenSource pendingRequestsCts,
> CancellationToken originalCancellationToken)
> at Thrift.Transport.Client.THttpTransport.FlushAsync(CancellationToken
> cancellationToken)
> Stack Trace:
> Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
> Task`1.GetResultCore(Boolean waitCompletionNotification)
> HiveServer2Statement.ExecuteUpdate() line 39
> DriverTests.CanExecuteUpdate() line 122
> RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature
> sig, Boolean isConstructor)
> MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
> ----- Inner Stack Trace -----
> THttpTransport.FlushAsync(CancellationToken cancellationToken)
> Client.send_ExecuteStatement(TExecuteStatementReq req, CancellationToken
> cancellationToken) line 240
> Client.ExecuteStatement(TExecuteStatementReq req, CancellationToken
> cancellationToken) line 226
> HiveServer2Statement.ExecuteStatementAsync() line 116
> HiveServer2Statement.ExecuteQueryAsync() line 43
> HiveServer2Statement.ExecuteUpdateAsync() line 61
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)