Re: [cx-oracle-users] Why do Connection and SessionPool objects not share an Environment?
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-09-19 14:31:08
|
On 9/19/06, Alex Tingle <al...@fi...> wrote: > Hi Anthony, > > On 19 Sep 2006, at 14:49, Anthony Tuininga wrote: > > > May I ask why you asked the question in the first place? > > I'll answer the last question first: I'm toying with the idea of > 'porting' cx_Oracle to be a C++ interface to OCI. It's really and > exercise in teaching myself to use OCI. The practical result is I'm > reading the source code, and trying to work out what it's doing. Ok. Just be aware that the OCI is a jungle and you need a good sharp machete to make your way through it... :-) The part that is the most convoluted is the whole binding/defining area -- the rules are very obscure and often found only by trial and error. I'm very happy to not have to deal with the OCI very much at all on a regular basis! > The code I'm asking about puzzled me. It was either very subtle, or a > potential bug. If it's subtle, I wanted to know. If it's a bug, I > thought you'd want to know. Sure. If its a bug I'd certainly like to know about it. I don't believe it is, though. We have an application that is heavily threaded and uses session pools and it appears to be very stable. We've run it overnight with about 10-15 threads constantly making queries and it has worked flawlessly. > > If I understand correctly, however, the environment handle is the > > "master" handle and all of the other handles are children to it. > > That seems reasonable. But if the environment handle is the "master" - > how can it be right to make a new environment for a session handle > that's been acquired from a pool that already HAS an environment? Not certain. Oracle doesn't provide much information about these sorts of things in the OCI. Its one of those things you simply try -- and if it works you're happy. I can't remember if I tried the other method but I think I did and it didn't work very well. Feel free to try it yourself, though, as my memory may be faulty. :-) > > In order to establish thread safety you want to make sure that the > > handles from one thread are not used in another -- otherwise you need > > to establish locking and the like which has its own set of issues. > > cx_Oracle's Environment struct contains an errorHandle as well as an > env handle. Each thread certainly needs its own error handle. Perhaps a > new Environment struct was made in order to make a new error handle, > and the new env handle was just made by mistake? Maybe, but I don't think so. > I assume that it works OK, even if it's strictly incorrect. It does work OK. I'm not sure if it is strictly incorrect or not. If you can find a pointer in the OCI documentation about this I'd be happy to see it. > If you think that cx_Oracle is wrong, then I might send you a patch, if > you like. Try it first and let me know how it works for you. :-) > -Alex > > -- > > > On 9/18/06, Alex Tingle <al...@fi...> wrote: > >> Hello, > >> > >> This is a question about the C implementation of cx_Oracle. I've been > >> reading the source code and trying to understand how you are using > >> OCI. > >> > >> When a Connection is acquired from a SessionPool, it creates a brand > >> new > >> environment for itself, rather than using the environment that the > >> SessionPool already has. That seems odd to me. (See > >> Connection_Acquire() > >> and Connection_Init() in Connection.c.) > >> > >> Can you explain why you create a new environment? > >> > >> Are you following the OCI documentation (if so where - I can't find > >> anything that suggests this) or have you established the method's > >> reliability by experience? > >> > >> (Sorry in advance if this is a stupid question.) > >> > >> -Alex > >> > >> -- > >> :: Let me solve your problems: http://www.firetree.net/consulting/ > >> :: alex.tingle AT firetree.net +44-7901-552763 > >> > >> ---------------------------------------------------------------------- > >> --- > >> Take Surveys. Earn Cash. Influence the Future of IT > >> Join SourceForge.net's Techsay panel and you'll get the chance to > >> share your > >> opinions on IT & business topics through brief surveys -- and earn > >> cash > >> http://www.techsay.com/default.php? > >> page=join.php&p=sourceforge&CID=DEVDEV > >> _______________________________________________ > >> cx-oracle-users mailing list > >> cx-...@li... > >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >> > > > > ----------------------------------------------------------------------- > > -- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > opinions on IT & business topics through brief surveys -- and earn cash > > http://www.techsay.com/default.php? > > page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |