Multi Thread aplication

When exactly does this error occur? Have you set TOracleSession.ThreadSafe to True?

------------------
Marco Kalter
Allround Automations
 
Marco,

First of all, sorry for my english ... I have tried this simple test program ... I tried with ThreadSafe = True and ThreadSafe = False, but the errors it seems to be aleatory. I can
 
Perhaps you can send me a complete demo project by e-mail?

------------------
Marco Kalter
Allround Automations
 
Marco,
Has this been resolved? I am experiencing similar problems. I have a server that uses HTTP to handle multiple client requests. Each request is handled on a separate thread. I am using a common ThreadSafe session for all of the threads, but anytime I have two threads attempting to Connect the session at the same time, I get either an EORacle error or an EExternalError.

This is a very critical problem for us to resolve.

Thanks,
Will

Originally posted by mkalter:
Perhaps you can send me a complete demo project by e-mail?

 
Two threads are connecting the same session? That might indeed cause problems. You should probably connect and disconnect this common session in the main thread, and only perform database access in the threads.

You should preferably use a session instance per thread though. If you use one session, all database access operations from different threads will be serialized. A session can only perform one operation at a time.

------------------
Marco Kalter
Allround Automations
 
If I need to use more than one session, I usually create a small pool of say 5 or so sessions. I add them to a TList descendent stored in a private variable within the main module of the application. You can either use them at random, or, more efficiently, prioritize them. Allocate the first two to GUI queries, and the rest to queries. You can even do a neat trick like pull them from the "available pool" into an "in use pool", then put them back as they are not used anymore. I would definitely connect them all up front, and leave them connected for the duration of the application.
 
I had similar problems and solved it with a global critical section around the LogOn() and LogOff() when doing it from a couple of threads at the same time.
Don't know if it's the right fix...

juergen
 
I'm not sure either. If we could get some confirmation on this, we could implement this in LogOn and LogOff. It may be a Net8 specific bug, but if we can prevent this, it would be worthwhile.

------------------
Marco Kalter
Allround Automations
 
Back
Top