Using OpenTelemetry instrumentation and setting EnableSqlIdTracing = true causes errors when working with refcursor output of a packaged procedure
While using Oracle.ManagedDataAccess.Core v23.5.1 and v23.6.0 (not sure about prior versions), and wiring up OpenTelemetry via Oracle Data Provider Instrumentation, setting EnableSqlIdTracing to true
tracing.AddOracleDataProviderInstrumentation(opt =>
{
opt.EnableSqlIdTracing = true;
.....
});
causes Oracle exception to be thrown when reading refcursor returned by a packaged procedure.
Can you turn on ODP.NET tracing and share the trace?
@alexkeh , can I provide it via email ?
Yes, you can send it to dotnet_us(at)oracle.com.
Traces sent.
Thanks @omon77 for reporting this issue. I was able to reproduce your findings with the test case. I've filed a bug (37160309) and will have the ODP.NET dev team review the issue to identify the root cause.
Thank you @alexkeh !
Hello, I'm having problems when I use EnableSqlIdTracing = true with some queries as well. One of the cases is when there is a BLOB type column in the query return.
I think this problem is related to this issue.
query (column NOMEARQUIVO has type BLOB):
SELECT
ADA.CODANEXO,
ADA.TIPODOCUMENTOANEXO,
ADA.ANEXADOEM,
ADA.ARQUIVO,
ADA.NOMEARQUIVO,
ADA.EXTENSAOARQUIVO
FROM ADM$DOCUMENTOANEXO ADA
WHERE CODPACIENTE = :CodPaciente
AND ADA.DELETADO = 0
exception:
at OracleInternal.TTC.TTCExecuteSql.<ReceiveExecuteResponseAsync>d__103.MoveNext()
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
at OracleInternal.ServiceObjects.OracleDataReaderImpl.<FetchMoreRowsAsync>d__116.MoveNext()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
at Oracle.ManagedDataAccess.Client.OracleDataReader.<ReadInternalAsync>d__368.MoveNext()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
at Oracle.ManagedDataAccess.Client.OracleDataReader.<ReadAsyncHelper>d__338.MoveNext()
at Dapper.SqlMapper.<QueryAsync>d__33`1.MoveNext()
at Program.<>c.<<<Main>$>b__0_0>d.MoveNext() in D:\source\AspireApp13\AspireApp13.ApiService\Program.cs:line 28
at Microsoft.AspNetCore.Http.RequestDelegateFactory.<<ExecuteTaskOfT>g__ExecuteAwaited|132_0>d`1.MoveNext()
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<<Invoke>g__Awaited|10_0>d.MoveNext()
@andrevlins Your issue could be a separate one. The exception reported in the original issue is the following:
2024-10-10 13:31:12.695071 TID:1 (PRI) (TTC) (ERR) (CID1) OracleException.HandleError() from TTCExecuteSql.Process_RPA_Message()(txnid=n/a) System.Exception: TTC Error at OracleInternal.TTC.OraBufReader.ReadLengthAndData(Byte repOffset, Byte typeRep, Boolean bAsync, Boolean IgnoreData) at OracleInternal.TTC.MarshallingEngine.BufferToValue(Byte repOffset, Boolean bAsync, Boolean bIgnoreData) at OracleInternal.TTC.MarshallingEngine.UnmarshalUB2(Boolean bAsync, Boolean bIgnoreData) at OracleInternal.TTC.TTCExecuteSql.Process_RPA_Message(Int64[] scnFromExecution, SqlStatementType statementType, Int32 arrayBindCount, RER_RefAndOutParamArgCtx refOutArgCtx, Boolean bReadSqlId, Boolean bAsync)
That's different from your issue. Can you share a trace from the ODP.NET app? That will tell us more details about what is generating the error.
This seems to still be a issue when using refcursors in 23.9 See this repo for code that procues the error: https://github.com/mvn-dips/OracleTelemetryError
Unhandled exception. System.Exception: TTC Error at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponseAsync(Accessor[] bindAccessors, Boolean bHasReturningParams, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int64 noOfRowsToFetch, I nt32 longFetchSize, Int64 clientInitialLOBFetchSize, Int64 initialLOBFetchSize, Int64 initialJSONFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, Boolean bDefineDone, RER_RefAndOutParamArgCtx refOutArgCtx, Boolean bReadSqlId, Boolean bLOBArrayFetchRequired, Boolean bAsync) at OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRowsAsync(Int64 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes, Boolean bAsync) at Oracle.ManagedDataAccess.Client.OracleDataReader.ReadInternalAsync(Boolean bAsync, CancellationToken cancellationToken) at Oracle.ManagedDataAccess.Client.OracleDataReader.ReadAsyncHelper(CancellationToken cancellationToken) at Program.<<Main>$>g__ExecuteDummyCommand|0_0(OracleConnection oracleConnection) in C:\GIT\OracleTelemetryError\OracleTelemetryError\Program.cs:line 50 at Program.<Main>$(String[] args) in C:\GIT\OracleTelemetryError\OracleTelemetryError\Program.cs:line 31 at Program.<Main>(String[] args)