Problem with long datatype and multithreaded app
Posted: Wed 19 Sep 2007 12:57
We are experiencing a number of different errors when selecting data_default from user_tab_columns oracle view from multiple threads.
Using the latest OraDirect 4.20 with Oracle 9.2.0.6 Server + Client and this code:
the error is always on the or.Read() line and varies between
Object reference not set to an instance of an object.
Index was outside the bounds of the array.
and ocassionally we get something like this
The runtime has encountered a fatal error. The address of the error was at 0x79e8eee5, on thread 0xa1c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
which brings down the whole application
This problem does not occur with direct = true
We did some debugging with windbg and found that there were some access violations being reported, which makes me wonder if it is related to this issue
http://www.crlab.com/forums/viewtopic.php?t=10297
which seems to be doing very similar things to my code.
Using the latest OraDirect 4.20 with Oracle 9.2.0.6 Server + Client and this code:
Code: Select all
private void executethread()
{
OracleConnection oc = new OracleConnection();
oc.Direct = false;
oc.Server = "server";
oc.UserId="username";
oc.Password="password";
oc.Open();
OracleCommand ocmd = oc.CreateCommand();
ocmd.ParameterCheck = true;
ocmd.CommandText = "select data_default from user_tab_columns c where rownum=1";
ocmd.Prepare();
for (int i = 0; i threadlist = new List();
for (int i = 0; i < 5; i++)
{
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(executethread));
threadlist.Add(t);
t.Start();
System.Threading.Thread.Sleep(500);
}
for (int i = 0; i < threadlist.Count; i++)
{
threadlist[i].Join();
}
//label1.Text = "done";
}
Object reference not set to an instance of an object.
Index was outside the bounds of the array.
and ocassionally we get something like this
The runtime has encountered a fatal error. The address of the error was at 0x79e8eee5, on thread 0xa1c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
which brings down the whole application
This problem does not occur with direct = true
We did some debugging with windbg and found that there were some access violations being reported, which makes me wonder if it is related to this issue
http://www.crlab.com/forums/viewtopic.php?t=10297
which seems to be doing very similar things to my code.