Re: [cx-oracle-users] Why do Connection and SessionPool objects not share an Environment?
Brought to you by:
atuining
From: Alex T. <al...@fi...> - 2006-09-19 14:08:44
|
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. 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. > 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? > 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? I assume that it works OK, even if it's strictly incorrect. If you think that cx_Oracle is wrong, then I might send you a patch, if you like. -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 |