Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

OracleCommand Hang if cancelled while executing query on Database

Ricardo PachecoFeb 22 2024

C# Console application:

  • Net 6
  • Oracle.ManagedDataAccess.Core. Tested versions:
    • 3.21.130
    • 2.19.220

Client Oracle Server:

  • Oracle RAC
  • Version: 12.2.0.1.0

We are currently facing the following situation on a client's environment:

The console application is doing the following workload:

  • Open Oracle Connection
  • Create OracleCommand that does a select towards a table with a lot of records (relevant only for a longer query execution time).
  • Execute OracleCommand
  • Iterate through all records of the DataReader

If the OracleCommand is cancelled while the query is executing on the server, the application hangs indefinitely. This happens every single time.

If the Command is cancelled while iterating through the DataReader we get ORA01013: User requested cancel, as expected.

The cancellation hang happens both if the command is cancel using IDataReader.Cancel as if a ICommand.CommandTimeout is configured (and triggered).

The client has other Oracle Databases but none of those has this issue. I don't believe that these other databases are configured using Oracle RAC.

Below you can find the final part of the trace produced by the console application.

--------------------------------------------------------------------------------------

2024-02-08 12:04:04.137978 TID:1 (PRI) (SVC) (ENT) OracleConnectionImpl.AddAllPiggyBackRequests()

2024-02-08 12:04:04.138144 TID:1 (PRI) (SVC) (EXT) OracleConnectionImpl.AddAllPiggyBackRequests()

2024-02-08 12:04:04.139440 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.SendExecuteRequest()

2024-02-08 12:04:04.139835 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.GetExecuteOptions()

2024-02-08 12:04:04.139863 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.GetExecuteOptions()

2024-02-08 12:04:04.140293 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WriteOall8Message()

2024-02-08 12:04:04.140322 TID:1 (PRI) (TTC) (ENT) TTCFunction.WriteFunctionHeader()

2024-02-08 12:04:04.140330 TID:1 (PRI) (TTC) (ENT) TTCMessage.WriteTTCCode()

2024-02-08 12:04:04.140337 TID:1 (PRI) (TTC) (EXT) TTCMessage.WriteTTCCode()

2024-02-08 12:04:04.140342 TID:1 (PRI) (TTC) (EXT) TTCFunction.WriteFunctionHeader()

2024-02-08 12:04:04.140962 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WritePisdef()

2024-02-08 12:04:04.141035 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WritePisdef()

2024-02-08 12:04:04.141329 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.WritePisdefData()

2024-02-08 12:04:04.141666 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WritePisdefData()

2024-02-08 12:04:04.141713 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.WriteOall8Message()

2024-02-08 12:04:04.141723 TID:1 (PRI) (TTC) (EXT) TTCExecuteSql.SendExecuteRequest()

2024-02-08 12:04:04.148372 TID:1 (PRI) (TTC) (ENT) TTCExecuteSql.ReceiveExecuteResponse()

2024-02-08 12:04:09.111875 TID:5 (PRI) (ENT) OracleCommand.Cancel()

2024-02-08 12:04:09.112190 TID:5 (PRI) (SVC) (ENT) OracleCommandImpl.Cancel()

2024-02-08 12:04:09.112436 TID:5 (PRI) (SVC) (EXT) OracleCommandImpl.Cancel()

2024-02-08 12:04:09.112457 TID:5 (PRI) (EXT) OracleCommand.Cancel()

2024-02-08 12:04:14.108585 TID:11 (PRI) (TUN) (EXT) OracleTuner.DoWait()

2024-02-08 12:04:25.144217 TID:12 (PRI) (ENT) Connection.connect()

2024-02-08 12:04:25.144511 TID:12 (PRI) (ENT) OracleException.ctor()

2024-02-08 12:04:25.144842 TID:12 (PRI) (ENT) OracleError.ctor()

2024-02-08 12:04:25.145060 TID:12 (PRI) (EXT) OracleError.ctor()

2024-02-08 12:04:25.145085 TID:12 (PRI) (EXT) OracleException.ctor()

Summary:

12:04:04 - Command execution

12:04:09 - Command.Cancel triggered (we used a cancellation token)

12:04:25 - Console application was killed (Cntl+C on cmd).

--------------------------------------------------------------------------------------

The provided case is a minimal example of the issue that our product is facing on the client's environment.

This is happening on a delicate production environment, and we need to figure a way around the hang.

Any other information required regarding the client's Oracle environment will be forwarded by us and provided asap.

Comments
Post Details
Added on Feb 22 2024
3 comments
107 views