Forums » Enduro/X development »
tpcommit is not doing final commit to Oracle XA database
Added by Mohammed Imran over 1 year ago
Hello,
tpcommit is not committing transaction to the oracle 19c XA database, we don’t see any error as well. We have used following flow. tpopen -> tpbegin -> (tpsuspend -> tpresume) - > tpcommit -> tpclose. Below are the variables values set. we are using tmsrv server. Please let us know if anything we are missing here.
NDRX_XA_RES_ID=1
NDRX_XA_OPEN_STR=ORACLE_XA+SqlNet=ORACLESID1+ACC=P/dbuser/dbpass111+SesTM=180+LogDir=./+nolocal=f+Threads=true
NDRX_XA_CLOSE_STR=${NDRX_XA_OPEN_STR}
NDRX_XA_DRIVERLIB=libndrxxaoras.so
NDRX_XA_RMLIB=libclntsh.so.11.1
NDRX_XA_LAZY_INIT=1
NDRX_XA_FLAGS=RECON:*:3:100
Replies (9)
RE: tpcommit is not doing final commit to Oracle XA database - Added by Madars over 1 year ago
Hello,
1) Is your XATMI service actually working with the XA connection and not the local connection? What API do you use for Oracle DB connection? Can you post the code how do you connect to DB?
2) Can you add full configuration files here? XML and INI?
3) Check the service statistics:
$ xadmin psc
@TM... service shall have completed some requests in case of normal operation.
4) Check the tmsrv logs, to see any activity and results
5) You can inspect in-flight XA transactions by running
$ xadmin pt
If there is any active transaction, it will list it.
The above shall give some hint in which direction to look.
RE: tpcommit is not doing final commit to Oracle XA database - Added by Mohammed Imran over 1 year ago
Please find below response.
1) Yes it is connecting with XA connection, we do see logs are connected to XA. We use OCI for DB connection. following function sequence for connecting database.
OCIHandleAlloc
OCIServerAttach
OCIAttrSet -> pass data base details
OCISessionBegin
2) Attached.
3)one of the core API log generating message “ tpcommit:Not in global Tx”, could this be the reason for not committing? Not sure what it means.
4) It shows “xa_open ok”.
5) Please see result of this command.xadmin pt
Enduro/X 8.0.6, build Aug 21 2022 02:04:50, using epoll for LINUX (64 bits)
Enduro/X Middleware Platform for Distributed Transaction Processing
Copyright (C) 2009-2016 ATR Baltic Ltd.
Copyright (C) 2017-2022 Mavimax Ltd. All Rights Reserved.
This software is released under one of the following licenses:
AGPLv3 (exceptions for Java, Go) or Mavimax license for commercial use.
N:NDRX:2:04032683:344108:7fb1c2452900:000:20230901:122642434901:_open_rply_q:config.c:0133:Reply queue [/key_name,sys,bg,xadmin,344108] opened!
- Shared resources opened...
- ndrxd PID (from PID file): 322134
RE: tpcommit is not doing final commit to Oracle XA database - Added by Madars over 1 year ago
3)one of the core API log generating message “ tpcommit:Not in global Tx”, could this be the reason for not committing? Not sure what it means.
This could be the reason.
Is this process responsible for starting the transaction? Was there tpbegin in this process? Or you relay on auto-transactions?
Please configure debug for your system.
Add to environment settings:
export NDRX_DEBUG_CONF=/path/to/ndrxdebug.conf
Add processes to your debug:
$ cat << EOF > /path/to/ndrxdebug.conf # note that default level is 2 (error). 3 is warning, 4 info, 5 debug. # thus if you want to trace down all apis, please temporary set debug to 5 for all (ndrx=5) * ndrx=5 ubf=1 lines=1 bufsz=1 tp=3 file= # Per binary config: xadmin file=/usr/mbs/log/EnduroX/ndrxd.$MBS_DATABASE.log ndrxd file=/usr/mbs/log/EnduroX/xadmin.$MBS_DATABASE.log your_server_binary file=${NDRX_APPHOME}/log/your_server.log ndrx=5 # ensure that tmsrv has level 5 too (however it would inherit for * - defaults anyway) tmsrv ndrx=5 file= EOF
restart your app and run the Core api which does not commit, after that can you please attach ${NDRX_APPHOME}/log/your_server.log?
This will give some insight what did the binary actually do and for what reason it gave error that it is not in the transaction.
You can read more about debugging settings here: https://www.endurox.org/dokuwiki/doku.php?id=endurox:v8.0.x:manuals:ndrxdebug.conf.5
RE: tpcommit is not doing final commit to Oracle XA database - Added by Mohammed Imran over 1 year ago
Yes it has tpbegin, please find attached debug log generated.
ACM-X101.log.txt (35.7 KB)
RE: tpcommit is not doing final commit to Oracle XA database - Added by Madars over 1 year ago
Hi,
According to log, for some reason commit is executed twice. However first commit did succeed (thus it is expected that changes shall be present in DB).
n:NDRX:4:04032683:1201657:7fdd87c1be40:001:20230905:114221791804:bug_dump_UBF:/utils.c:0253:Response buffer: ((BFLDID32)122) 1 ((BFLDID32)123) 3 ((BFLDID32)124) 4 ((BFLDID32)130) 0 ((BFLDID32)131) 0 ((BFLDID32)151) 3 ((BFLDID32)33554593) 0 ((BFLDID32)67108984) c ((BFLDID32)167772281) YZT3oUBAAAASVdOh7MS45mT3TFwf6wMAAQAE ((BFLDID32)167772285) \03 ((BFLDID32)167772292) Success ((BFLDID32)167772310) srv,ACM-X101,10,1201657,1,1 n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221791837:m_generic_fb:autils.c:0870:atmi_xa_call_tm_generic returns 0x2590660 n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221791843:drx_tpcommit:tmi/xa.c:1424:Transaction [YZT3oUBAAAASVdOh7MS45mT3TFwf6wMAAQAE] commit OK n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221791853:tpfree_inner:ed_buf.c:0440:_tpfree buf=0x2590660
and then for some reason tpcommit is tried again:
n:NDRX:2:04032683:1201657:7fdd87c1be40:001:20230905:114221792415:drx_tpcommit:tmi/xa.c:1325:tpcommit: Not in global TX n:NDRX:3:04032683:1201657:7fdd87c1be40:001:20230905:114221792421:et_error_msg:perror.c:0299:_TPset_error_msg: 9 (TPEPROTO) [tpcommit: Not in global TX] R:USER:1:04032683:1201657:7fdd87c1be40:001:20230905:114221792429:tplog :/tplog.c:0583:committed by tpcommit n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221792440:_tpreturn :return.c:0107:_tpreturn enter data=0x26c7af0 n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221792451:_mbuf_tlv_do:ltibuf.c:0429:Prep tag: 0 (ttag 0, type 0). Src 0x26c7af0, dst 0x7fdd7bbe0240 olen_max=1049080 new_used=16 pad=0 buffer_left=1049064 n:NDRX:5:04032683:1201657:7fdd87c1be40:001:20230905:114221792483:_mbuf_tlv_do:ltibuf.c:0443:tag=0 loaded new_used=8004
If the changes are sitll not present int DB, pls try to update environment settings:
FROM: NDRX_XA_OPEN_STR=ORACLE_XA+SqlNet=ORACLESID1+ACC=P/dbuser/dbpass111+SesTM=180+LogDir=./+nolocal=f+Threads=true TO: NDRX_XA_OPEN_STR=ORACLE_XA+SqlNet=ORACLESID1+ACC=P/dbuser/dbpass111+SesTM=180+LogDir=./+NoLocal=true+Threads=true
this will ensure that local transactions are disabled for the process.
Another thing, maybe you can try to perform changes without suspend, does in that case you see the updates in DB?
RE: tpcommit is not doing final commit to Oracle XA database - Added by Mohammed Imran over 1 year ago
Hi Madars,
We removed additional tpcommit and now there is no error for "Not in global Transaction", We did try changing NDRX_XA_OPEN_STR, but still we don't see transaction is committed to db, if we use OCI commit function (OCITransCommit) then transaction is committing successfully.
We also tried with removing suspend and resume logic as well but don't see commit happening.
Thanks and Regards.
RE: tpcommit is not doing final commit to Oracle XA database - Added by Lauris over 1 year ago
Hello,
1) Yes it is connecting with XA connection, we do see logs are connected to XA. We use OCI for DB connection. following function sequence for connecting database. OCIHandleAlloc OCIServerAttach OCIAttrSet -> pass data base details OCISessionBegin
According to the https://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adga1_xa.htm section "Extensions to the XA Interface"
you shall use xaoSvcCtx() to get the OCI connection and use xaoEnv() allocate handles.
RE: tpcommit is not doing final commit to Oracle XA database - Added by Mohammed Imran over 1 year ago
Hi,
We are already using xaoSvcCtx and xaoEnv() to initialize XA connection.
tpcommit is not committing despite log shows success.
RE: tpcommit is not doing final commit to Oracle XA database - Added by Lauris over 1 year ago
Please see following test case with OCI library: https://github.com/endurox-dev/endurox/blob/master/atmitest/test047_oradb/atmisv47_oci.c
It works as expected, the INSERT operations works as with global transactions started in either way, ( tpbegin() by process it self, or if service is called in global transaction).
The connection string looks like:
export NDRX_XA_OPEN_STR="ORACLE_XA+SqlNet=$EX_ORA_SID+ACC=P/$EX_ORA_USER/$EX_ORA_PASS+SesTM=180+LogDir=./+NoLocal=true+Threads=true+Loose_Coupling=false" export NDRX_XA_CLOSE_STR=$NDRX_XA_OPEN_STR
please check your code, how the OCI connects to the DB / statements..
Our working example is not using calls you specified:
OCIServerAttach OCIAttrSet -> pass data base details OCISessionBegin
from your described results, it looks like OCI is connected locally to DB and works with local transactions. And global transaction started is managing read-only transaction, where OCI library have not changed anything. For such read-only transaction tpcommit() normally succeeds too.
(1-9/9)