Problem with long datatype and multithreaded app

Problem with long datatype and multithreaded app

Postby DarrenColes » 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:

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 < 1000; i++)
            {
                OracleDataReader or = ocmd.ExecuteReader();
                or.Read();
                or.Close();
                or.Dispose();
                or = null;
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            List 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";

        }


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.
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Thu 20 Sep 2007 08:58

We will investigate your code.
Look forward to the reply.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Alexey » Fri 21 Sep 2007 11:44

This problem is fixed.
Look forward to the next build.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby DarrenColes » Fri 21 Sep 2007 13:26

thanks for your prompt response on this.
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Fri 21 Sep 2007 14:10

You are welcome.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby DarrenColes » Tue 25 Sep 2007 16:27

we've managed to work around this issue in our app now and the problem is greatly reduced, however we are still seeing the odd crash - can you tell me if this issue is related to LONG field types as we suspected and are there any other field types that are affected?

Basically do you have any information that might help us figure out what other queries might be causing us problems
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Wed 26 Sep 2007 07:17

We haven't encountered the problem with other types earlier.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby DarrenColes » Wed 26 Sep 2007 08:56

I was hoping that based on the changes that were made to fix the issue you might be able to tell me roughly what causes the problem so I can see if i can do some further workarounds until the fix is released
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Wed 26 Sep 2007 09:23

It seems like OCI mixes up packages during the simultaneous fetch of two LONG fields.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby DarrenColes » Wed 26 Sep 2007 09:32

thanks
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Wed 26 Sep 2007 09:35

Not at all.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby DarrenColes » Tue 16 Oct 2007 08:20

any news on when the next build might be?
DarrenColes
 
Posts: 47
Joined: Mon 28 Aug 2006 11:07

Postby Alexey » Tue 16 Oct 2007 10:38

We are going to release a new version (OraDirect .NET 4.25). This will take some time.
Hopefully, it will be available next week.
Thanks for your patience.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Alexey » Tue 30 Oct 2007 16:47

Please try new version of OraDirect .NET 4.25.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for Oracle