oracle/dotnet-db-samples

Using OpenTelemetry instrumentation and setting EnableSqlIdTracing = true causes errors when working with refcursor output of a packaged procedure

omon77 opened this issue · 10 comments

omon77 commented

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?

omon77 commented

@alexkeh , can I provide it via email ?

Yes, you can send it to dotnet_us(at)oracle.com.

omon77 commented

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.

omon77 commented

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.

@alexkeh here are the traces

traces.zip