Page 1 of 1
I just sent a bunch of general and Oracle specific fixes
Posted: 03.11.2020, 17:50
by aehimself
Hey guys,
I recently discovered some issues with how Zeos 8.0 and the Oracle protocol specifically handled connection losses so I made some changes and issued a pull request on GitHub. It is working fine on my side, but since I added a new property and touched some TZAbstractConnection .SetActive and .PingServer logic too please doublecheck if my solution fits the Zeos codebase.
https://github.com/marsupilami79/zeoslib/pull/22
Thanks!
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 03.11.2020, 21:41
by marsupilami
I checked in the changes to trunk / master. I left it to EgonHugeist to apply these changes to Zeos 8.0 if he likes them. So - this basically means that Zeos (8.0) currently (without this patch) cannot use Oracle in in a multithreaded application in the usual way - one connection per thread? If so, I will have to add that to the release notes.
It seems to me that we need some (small) multithreading documentation. There now are at least two databases (Oracle, SQLite) who need special attention before they can be used safely in a multithreaded environment?
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 04.11.2020, 08:19
by aehimself
marsupilami wrote: ↑03.11.2020, 21:41I checked in the changes to trunk / master. I left it to EgonHugeist to apply these changes to Zeos 8.0 if he likes them.
The good thing about waking up late is that he didn't just merge it to 8.0; it's already visible on GitHub as well! Cheers for that :)
marsupilami wrote: ↑03.11.2020, 21:41So - this basically means that Zeos (8.0) currently (without this patch) cannot use Oracle in in a multithreaded application in the usual way - one connection per thread? If so, I will have to add that to the release notes.
Well, yes and no. The thing I realized is that the OCI driver was wildly throwing nullpointer exceptions here and there if certain - but unknown - conditions were met. Yesterday for example it threw a nullpointer exception instead of the timeout message when a connection could not be established. This was my starting point.
After adding this patch to my local Zeos repo the issue seems to have disappeared - however as it was wildly random, I'll need some time of continuous testing to be able to tell for sure.
I think that OCIMultiThreaded only tells the driver to use Mutexes inside, therefore the execution of different threads won't scramble.
marsupilami wrote: ↑03.11.2020, 21:41It seems to me that we need some (small) multithreading documentation. There now are at least two databases (Oracle, SQLite) who need special attention before they can be used safely in a multithreaded environment?
I personally weren't able to make SQLIte to work in my multithreaded application. It always threw the wait time error :)
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 04.11.2020, 09:01
by marsupilami
aehimself wrote: ↑04.11.2020, 08:19
Well, yes and no. The thing I realized is that the OCI driver was wildly throwing nullpointer exceptions here and there if certain - but unknown - conditions were met. Yesterday for example it threw a nullpointer exception instead of the timeout message when a connection could not be established. This was my starting point.
After adding this patch to my local Zeos repo the issue seems to have disappeared - however as it was wildly random, I'll need some time of continuous testing to be able to tell for sure.
I think that OCIMultiThreaded only tells the driver to use Mutexes inside, therefore the execution of different threads won't scramble.
Yep - which basically means, using Zeos 7.2 for multi threaded applications on Oracle isn't safe.
So I will add that to the release notes as a known issue.
aehimself wrote: ↑04.11.2020, 08:19
I personally weren't able to make SQLIte to work in my multithreaded application. It always threw the wait time error
Ok - I don't have experience with SQLite but to me that still sounds like you set SQLiteOpen_Flags to SQLITE_OPEN_NOMUTEX or SQLITE_OPEN_FULLMUTEX? But even then - if I read
The SQLite documentation on Multi-Threaded Applications correctly, SQLite needs to be compiled with Multi-Threading support to make this work:
Using SQLite In Multi-Threaded Applications / Run-time selection of threading mode wrote:Nor is it possible to escalate an individual database connection if the compile-time or start-time mode is single-thread.
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 04.11.2020, 09:47
by aehimself
marsupilami wrote: ↑04.11.2020, 09:01Yep - which basically means, using Zeos 7.2 for multi threaded applications on Oracle isn't safe. ;) So I will add that to the release notes as a known issue.
I guess it should be possible to add that change to 7.2 too...? Maybe even the whole commit...?
marsupilami wrote: ↑04.11.2020, 09:01Ok - I don't have experience with SQLite but to me that still sounds like you set SQLiteOpen_Flags to SQLITE_OPEN_NOMUTEX or SQLITE_OPEN_FULLMUTEX? But even then - if I read
The SQLite documentation on Multi-Threaded Applications correctly, SQLite needs to be compiled with Multi-Threading support to make this work:
Using SQLite In Multi-Threaded Applications / Run-time selection of threading mode wrote:Nor is it possible to escalate an individual database connection if the compile-time or start-time mode is single-thread.
I did not change anything and I used the DLL available on their website. I never managed to get it to work but it was not important so I simply abandoned the idea :)
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 10.11.2020, 06:38
by EgonHugeist
@aehimself
According your patch i just wanna say: Awesome job! That rocks! Thank you very much.
Re: I just sent a bunch of general and Oracle specific fixes
Posted: 10.11.2020, 11:29
by aehimself
Np, glad I could help.
I'm also glad that these mysterious oci.dll nullpointer AVs should be gone for good... they were driving me INSANE!