OracleException: Network error ???

OracleException: Network error ???

Postby jkAhn » Mon 03 Mar 2008 05:53

Hello.

I have been encounterd these errors when developing my apps but I don’t know why.
Errors…
CoreLab.Oracle.OracleException: Network error: 203
CoreLab.Oracle.OracleException: Network error: 204
CoreLab.Oracle.OracleException: Network error: 207

I used shared connection in direct mode and use below environments
Oracle 10g standard.
Oradirect 4.50
.net framework 2.0 in VS2005

Can I get some info about how to solve these problem?

Best regards.
Thank you.
jkAhn
 
Posts: 1
Joined: Mon 03 Mar 2008 05:49
Location: Seoul, Korea

Postby Alexey.mdr » Mon 03 Mar 2008 10:45

Could you specify the OS on the server side as well as on the client side?
Is this problem sporadic?
When exactly do you receive the error (e.g. when you open a connection or on a command execution)?
Please post the stacktrace and the block of code where the exception occurs.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby sprinter252 » Mon 03 Mar 2008 11:15

Hello,

I just get the same errors on a Windows XP SP 2 against an Oracle 10.2 in Direct-Access-Mode. I'm using OraDirect 4.30.20.

The errors are sporadic but reproducable. Thy occur specially if I'm doing a lot of SELECT- and INSERT/UPDATE-commands (import-job) one-by-one. An earlyier version of this job was doing it in a single thread. This leads to one of the network errors after 10 to 20 commands. Now I get error 203 in most cases if I start my import job the first time. The application is crashing complete afterwards :shock: ! If I restart my app and retry the job, everything works fine!

By the way: I can't send you sample-code, because it is a huge multi-tier-app! :lol:

HTH
sprinter
sprinter252
 
Posts: 23
Joined: Fri 16 Nov 2007 20:10
Location: Germany

Postby Alexey.mdr » Mon 03 Mar 2008 16:33

Do you use multithreading? These error messages indicate low-level protocol errors.
Probably one connection is used by several threads simultaneously.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby sprinter252 » Tue 04 Mar 2008 11:08

Hi Alexey,

yes, this was my first thought too. But then the error occured even in single threaded mode! I will test it again and follow up a posting if I get something more specific!

sprinter252
sprinter252
 
Posts: 23
Joined: Fri 16 Nov 2007 20:10
Location: Germany

Postby Alexey.mdr » Tue 04 Mar 2008 14:17

If it's reproducible in a single thread application probably
you can create a small test example. It will help us greatly.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby sprinter252 » Tue 04 Mar 2008 14:50

Unfortunately it is the same up and I just switched multihreading off. So the packing would still be very tricky. Let's see :)
sprinter252
 
Posts: 23
Joined: Fri 16 Nov 2007 20:10
Location: Germany

Postby Alexey.mdr » Tue 04 Mar 2008 15:39

You know, sometimes it's really hard to locate such problems.
If you could manage to localize the source it will greatly ease our work.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby loveacs » Mon 17 Mar 2008 08:13

hello,
I am a co-worker of jkAhn.
First, I am very sorry for late reply.

As sprinter252 said, I think, too, that more frequently produced the problems in many commands are excuted at the same time.
(sometimes, It seems the problem occurs by just two heavy commands requesting blob/clob data)
It ouccured sporadic, and next time i tryed it works fine, too.

My apps used multi-threading in single session.
(we have to use single session for very busy server.)

Environments.
Client side
- OS : Win XP SP2
- Oradirect 4.50 (Direct-Access mode)
- .net Framework 2.0 in VS2005
Server side
- Oracle 10g standard (10.2.0.3.0)
- Redhat Linux 9.x

This is the stacktrace..
CoreLab.Oracle.OracleException
Message="Network error: 207"
Source="CoreLab.Oracle"
ErrorCode=-2147467259
Code=207
Offset=0
StackTrace:
Location: CoreLab.Oracle.OracleDataReader.Close()
Location: CoreLab.Oracle.OracleDataReader.Finalize()

And, below simple code produces errs sometimes.
Code:
Code: Select all
(omitted using ...)
namespace Err {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        OracleConnection oc = new OracleConnection();
        BackgroundWorker bw = new BackgroundWorker();
        private void Form1_Load(object sender, EventArgs e){
            oc.ConnectionString = "User Id=a;Password=a;Server=1.1.1.1;Direct=True;Sid=a;unicode=True;";
            oc.Open();
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
        }
        void bw_DoWork(object sender, DoWorkEventArgs e) {
            OracleCommand cmd = oc.CreateCommand();
            cmd.CommandText = " select * from tv_gsmmap_cdr ";
            OracleDataReader odr = cmd.ExecuteReader();
            OracleDataTable odt = new OracleDataTable();
            odt.Load(odr);          //    <-- IDE point this line occured the err.
        }
        private void simpleButton1_Click(object sender, EventArgs e) {
            bw.RunWorkerAsync();
        }
        private void simpleButton2_Click(object sender, EventArgs e) {
            OracleCommand cmd = oc.CreateCommand();
            cmd.CommandText = " select * from tb_workspace ";
            OracleDataReader odr = cmd.ExecuteReader();
            OracleDataTable odt = new OracleDataTable();
            odt.Load(odr);         //     <-- this line occur err, too.
        }
    }
}


tv_gsmmap_cdr / tb_workspace tables have blob/clob columns.

1. simpleButton1 click.
2. During process first command, simpleButton2 click.
3. I can meet the errors occasionally.(Network error: 203/204/207 or Unknown Error 1)

HTH and TIA.
Best regards.

Kim
Last edited by loveacs on Mon 17 Mar 2008 15:16, edited 1 time in total.
loveacs
 
Posts: 2
Joined: Mon 14 Jan 2008 06:42

Postby Alexey.mdr » Mon 17 Mar 2008 11:05

Your multithreaded application at the same time requires access to methods and components that are not thread safe.
OracleConnection is not thread safe.
Every thread requires it's own connection.
Put the methods logic between OracleConnection.Open() and OracleConnection.Close().
Also you might want to use connection pooling technology.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby DwightFowler » Wed 02 Apr 2008 03:47

Alexey,

I am experiencing Network Error 207s and 204s in my project, too. All calls to CoreLab objects occur on the main UI thread. There is only one connection that remains open during the entire sequence of events. The application is multi-threaded.

My project is a plug-in for Visual Studio. When the error occurs it completely wipes out the Visual Studio application. The error stack indicates that the exception occurs in the
    CoreLabs.OracleData.OracleReader.Close();
    CoreLabs.OracleData.OracleReader.Finish();
method.

I have been able to work around the exception by pausing the thread for 1 second before each call to OracleCmd.ExecuteReader(); i.e.
Code: Select all
        System.Threading.Thread.Sleep(1000);
        OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleResult);
This code is calling Oracle's DBMS_METADATA package:
Code: Select all
select DBMS_METADATA.GET_DDL('TABLE', 'MYTABLE', 'MYSCHEMA') from dual;
I am using parameter objects. The result set has a CLOB in it.

The OS the application runs on is Windows Vista Ultimate 64-bit, but it occurs on WinXP Pro SP2 32-bit as well. The database is Oracle 10g2 on a 64 bit Linux. I don't know the flavor of Linux but I can get it, if you need it. The errors occur with CoreLabs 4.30 and 4.50.

From what I've been able to gather the problem appears to be timing related, but I am only guessing. The problem gets worse when the application connects to the database through a VPN connection.

Can you help? The one second pause is a terrible kludge, and practically cripples our application. I have a small test application that can reproduce the problem on a VPN.

Thanks,
Last edited by DwightFowler on Wed 02 Apr 2008 18:07, edited 1 time in total.
DwightFowler
 
Posts: 9
Joined: Wed 02 Apr 2008 03:14

Postby Alexey.mdr » Wed 02 Apr 2008 08:33

There is only one connection that remains open during the entire sequence of events. The application is multi-threaded.
Let me quote myself
Your multithreaded application at the same time requires access to methods and components that are not thread safe.
OracleConnection is not thread safe.
Every thread requires it's own connection.
Put the methods logic between OracleConnection.Open() and OracleConnection.Close().
Also you might want to use connection pooling technology.
I guess it's the same in the current project.
Every thread must use a new connection.
Threads are like users for the server.
Simultaneously, threads are asking the server for some data,
and when the data is fetched they just got lost in the network packages.
Say a thread1 expected one data, but received some data for the thread2.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Hello Alexey

Postby sprinter252 » Wed 02 Apr 2008 10:16

just one question. Would it be a solution to use blockings (mutexes or so)? In some cases it is not so simple to use new connections because of transaction-problems. I know, I can use the Transaction-context as a single object too, but sometimes I'm working on huge projects which I didn't created. So the question is: How would a CoreLab-connection react, if it was locked by a thread?

Thanks,
Alex
sprinter252
 
Posts: 23
Joined: Fri 16 Nov 2007 20:10
Location: Germany

Postby Alexey.mdr » Wed 02 Apr 2008 11:32

You may try this option, but it is still risky.
Several methods of DbDataTable won't work with resource blockers.
It is recommended to use as many connections as many threads exist.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Multi-threading is not the issue

Postby DwightFowler » Wed 02 Apr 2008 18:30

Alexey,

I think I did not state the condition clearly. While the application may be multi-threaded. ALL CALLS TO CORELAB OBJECTS OCCUR ON THE MAIN UI THREAD.

If you are implying that CoreLabs components cannot work in a multi-threaded environment, that's a different story, and something that we need to know. I hope you are not implying that, though.

Besides, I can reproduce the problem in a simple application, running only one thread.
DwightFowler
 
Posts: 9
Joined: Wed 02 Apr 2008 03:14

Next

Return to dotConnect for Oracle