Page 1 of 2
OracleException: Network error ???
Posted: Mon 03 Mar 2008 05:53
by jkAhn
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.
Posted: Mon 03 Mar 2008 10:45
by Alexey.mdr
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.
Posted: Mon 03 Mar 2008 11:15
by sprinter252
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

! 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!
HTH
sprinter
Posted: Mon 03 Mar 2008 16:33
by Alexey.mdr
Do you use multithreading? These error messages indicate low-level protocol errors.
Probably one connection is used by several threads simultaneously.
Posted: Tue 04 Mar 2008 11:08
by sprinter252
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
Posted: Tue 04 Mar 2008 14:17
by Alexey.mdr
If it's reproducible in a single thread application probably
you can create a small test example. It will help us greatly.
Posted: Tue 04 Mar 2008 14:50
by sprinter252
Unfortunately it is the same up and I just switched multihreading off. So the packing would still be very tricky. Let's see

Posted: Tue 04 Mar 2008 15:39
by Alexey.mdr
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.
Posted: Mon 17 Mar 2008 08:13
by loveacs
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
Posted: Mon 17 Mar 2008 11:05
by Alexey.mdr
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.
Posted: Wed 02 Apr 2008 03:47
by DwightFowler
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,
Posted: Wed 02 Apr 2008 08:33
by Alexey.mdr
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.
Hello Alexey
Posted: Wed 02 Apr 2008 10:16
by sprinter252
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
Posted: Wed 02 Apr 2008 11:32
by Alexey.mdr
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.
Multi-threading is not the issue
Posted: Wed 02 Apr 2008 18:30
by DwightFowler
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.