Page 1 of 1

Unknown error 1

Posted: Tue 06 Aug 2019 14:27
by kpiechocinski
Need help with "Unknown error 1". Error appears occasionally, app can run for long time without any problem. But when it shows up, it's not going away, even after application restart.

Stack traces are:

Code: Select all

System.Exception: NET: Unknown error 1
   w Devart.Data.Oracle.ed.a(dj A_0, Int32 A_1)
   w Devart.Data.Oracle.ed.a(Int32 A_0, ej A_1)
   w Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   w Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   w Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   w Devart.Data.Oracle.OracleCommand.ExecuteReader(CommandBehavior behavior)
and

Code: Select all

System.Exception: NET: Unknown error 1
   w Devart.Data.Oracle.DirectUtils.d(Int32 A_0)
   w Devart.Data.Oracle.a9.a()
   w Devart.Data.Oracle.cc.c(Int32 A_0, Byte[] A_1, Int32 A_2, Int32 A_3)
   w Devart.Data.Oracle.cc.b(Int32 A_0, Byte[] A_1, Int32 A_2, Int32 A_3)
   w Devart.Data.Oracle.OracleLob.Read(Byte[] buffer, Int32 offset, Int32 count)
Also, as the problem persist after app's restart, i've tried different version of dotConnect(v. 9.6 is originally used) and it seems that using version 9.7 doesn't fix the problem, but downgrade to 9.5 makes everything works fine.

Re: Unknown error 1

Posted: Thu 08 Aug 2019 09:01
by Shalex
1. Please upload a small test project with the corresponding DDL/DML script to some file exchange server (e.g.: www.dropbox.com) and send us the download link.

2. Specify:
a) your Oracle Server
b) your connection string (mark confidential information with asterisks)

Re: Unknown error 1

Posted: Wed 14 Aug 2019 09:18
by kpiechocinski

Code: Select all

		public static void DBTest(int fileSize)
		{
			var connectionString = string.Format(
				"Data Source={0}; User Id={1}; Password={2}; SID={3}; Direct={4}; Port={5}",
				"127.0.0.1", "scott", "tiger", "XE", "true", "1521");

			var connection = new OracleConnection(connectionString);
			connection.Open();

			var cmd1 = new OracleCommand();
			try
			{
				cmd1.Connection = connection;
				cmd1.CommandText = "DROP TABLE Test";
				cmd1.ExecuteNonQuery();
			}
			catch (OracleException oe)
			{
				if (oe.Code != 942) // table does not exists;
					throw;
			}

			cmd1.CommandText = "CREATE TABLE Test(data BLOB)";
			cmd1.ExecuteNonQuery();

			cmd1.CommandText = "INSERT INTO Test Values(:data)";
			cmd1.Parameters.Add("data", OracleDbType.Blob);

			cmd1.Parameters["data"].Value = new byte[fileSize];
			cmd1.ExecuteNonQuery();
			Console.WriteLine("File size: {0}", fileSize);
			var checkBeginPos = (int) (0.79 * fileSize);
			Console.WriteLine("Checking from: {0}", checkBeginPos);
			var cmd = new OracleCommand();
			cmd.Connection = connection;
			cmd.CommandText = "SELECT data FROM Test";

			for (int readPosition = checkBeginPos; readPosition < fileSize; readPosition++)
			{
				try
				{

					using (var reader = cmd.ExecuteReader())
					{
						reader.Read();
						using (var blob = reader.GetOracleLob(0))
						{
							blob.Position = readPosition;
							byte[] readBuffer = new byte[fileSize];
							blob.Read(readBuffer, 0, readBuffer.Length);
						}
					}
				}
				catch (Exception e)
				{
					Console.WriteLine("{0}, Position: {1}", e.Message, readPosition);
					connection.Close();
					connection.Dispose();
					connection = new OracleConnection(connectionString);
					connection.Open();
					cmd.Connection = connection;
				}
			}
		}
.
DBTest(1095806) - no errors
DBTest(1095807) - "unknown error 1" appears for many readPosition values

Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

Re: Unknown error 1

Posted: Tue 20 Aug 2019 11:46
by Shalex
Thank you for the test code. We have reproduced the issue and will notify you when it is fixed.

Re: Unknown error 1

Posted: Sat 14 Sep 2019 13:20
by Shalex
The bug with throwing "Unknown error 1" by OracleDataReader.GetOracleLob() in the Direct mode is fixed: viewtopic.php?f=1&t=39337.