Open CaselIT opened 3 months ago
Ok, I looked into this and technically this isn't a bug. The problem is that if you call tpc_begin()
without specifying a value for the timeout
parameter, the default is 0 and that means you are telling the system that as soon as a transaction becomes inactive, the system can clean it up. So whether it actually gets around to it or not defines whether or not you get the error you are seeing. If you ensure that you set a value for the timeout
parameter that covers the length of time that the transaction will be inactive, then the problem goes away completely. The fact that thick mode doesn't exhibit this behavior suggests to me that the default is not actually 0 but some other value. I'll ask internally and find out what it is and change thin mode (and the documentation) to whatever I discover. In the meantime, you can simply set the timeout
parameter yourself and verify that the issue is resolved.
Thanks for checking. So a timeout was invited!
I failed to notice that timeout parameter in tpc_begin, but the behaviour seems consistent with it.
I'll retry the example with a timeout set, and see if it's settable using the sqlalchemy api
it does indeed seem the timeout fault. I think it would make sense from an usage point of view to have the same timeout as the thick mode, or at least document the difference.
see if it's settable using the sqlalchemy api
seems not. Will coordinate with mike about accepting kw-args there
it does indeed seem the timeout fault. I think it would make sense from an usage point of view to have the same timeout as the thick mode, or at least document the difference.
I agree and intend to make them the same once I find out what thick mode does. Stay tuned!
Hi,
With the 2.3 release I've added support for oracledb two phase commit in sqlalchemy. https://github.com/sqlalchemy/sqlalchemy/commit/a9c0487c024410d446b8be3f528e051318dd150e In the ci we noticed that a test was unreliable and decided to skip it in the ci. The test is this one https://github.com/sqlalchemy/sqlalchemy/blob/6cf5e2a188fc5e337d22a098a5fe9a9fe10cc7e7/test/engine/test_transaction.py#L476-L527 when
commit=True
. The same code using only oracledb is reported below.Initially the idea was to ask guidance since it seemed there was some kind of timeout, but trying the standalone example with different timeout and with and without the oracle client, seem to have surfaced a bug in the thin mode implementation.
2.3.0
error
What error(s) or behavior you are seeing?
Does your application call init_oracle_client()?
no, calling it fixes it
The above script errors usually after 10 to 30 runs:
uncommenting the timeout makes the fail even quicker:
With or without timeout using the oracle client results in no error (run about 100 try without timeout and 60 with). I've tried only on windows, but @zzzeek can reproduce locally on linux (fedora I think) using a different oracle version and config