Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-00604 hiding ORA-01013 when cancelling task

Brecht YpermanMay 6 2025 — edited May 6 2025

I usually get a TaskCanceledException or OperationCanceledException when canceling an async database operation.

Every now and then, though, I get the following exception:

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00604: Fout opgetreden bij recursief SQL-niveau 1.

ORA-01013: Huidige bewerking is geannuleerd op verzoek van gebruiker.

https://docs.oracle.com/error-help/db/ora-00604/

at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

--- End of stack trace from previous location ---

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

--- End of stack trace from previous location ---

at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)

at Oracle.EntityFrameworkCore.Storage.Internal.OracleExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()

at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)

This seems related to Bug 36710738 - ASYNC CANCEL RETURNS ORA-01013 INSTEAD OF OPERATIONCANCELLEDEXCEPTION, which was fixed in Oracle.ManagedDataAccess.Core 23.7.0.

Before I upgraded to 23.7, I used to handle the ORA-01013 error manually, so I don't really mind handling the ORA-00604, but:

a) 604 does not seem directly related to the cancellation, and I cannot get to the ‘inner’ 1013 error. I tried enumerating through the OracleErrors in the exception, but 604 is the only error number that seems to be reported.

b) I would prefer to just get the *CanceledExceptions.

I cannot reproduce the behavior, but I think it's when cancelling the following query, maybe that's causing the ‘recurse’ thing in the error message?

Here's a redacted version of the query:

SELECT "s".[...], "z".[...]
FROM (
SELECT [...]
FROM "TABLEA" "d"
INNER JOIN "TABLEB" "u" ON [...]
INNER JOIN "TABLEC" "p" ON [...]
WHERE (("p"."COLUMN_A" = :entity_equality_patient_0_COLUMNA) AND ("p"."COLUMN_B" = :entity_equality_patient_0_COLUMNB))
ORDER BY "d"."STARTDATE" DESC, "d"."INDEX" DESC
OFFSET :p_1 ROWS FETCH NEXT :p_2 ROWS ONLY
) "s"
LEFT JOIN "TABLED" "z" ON [...]
ORDER BY "s"."STARTDATE" DESC, "s"."INDEX" DESC
Comments
Post Details
Added on May 6 2025
2 comments
111 views