- Notifications
You must be signed in to change notification settings - Fork 96
Closed
Labels
Description
Hello!
My application starts multiple threads and every thread is trying to connect to different oracle database, using this module (2.4.1) in thin mode.
So every thread is creating his own independent connection.
It turned out that method connect hangs until driver is used in another thread.
To be more specific - until driver is creating connection in another thread, which may take a while bc of network or load issues.
I have made research and found out that it hangs in this place in command "manager.condition.wait()"
But funny part is if i comment out this string ( manager.condition.wait() ) - it works perfectly fast and well ! :)
So... Why? :)
def get_manager(requested_thin_mode=None): """ Returns the manager, but only after ensuring that no other threads are attempting to initialize the mode. NOTE: the current implementation of the driver only requires requested_thin_mode to be set when initializing the thick mode; for this reason the error raised is specified about a thin mode connection already being created. If this assumption changes, a new error message will be required. """ with manager.condition: if manager.thin_mode is None: if manager.requested_thin_mode is not None: manager.condition.wait() # this place if manager.thin_mode is None: if requested_thin_mode is None: manager.requested_thin_mode = True else: manager.requested_thin_mode = requested_thin_mode elif ( requested_thin_mode is not None and requested_thin_mode != manager.thin_mode ): errors._raise_err(errors.ERR_THIN_CONNECTION_ALREADY_CREATED) return manager