1
votes

When running a php program that uses OCI8 library in PHP to connect to an Oracle server and loop through an oracle cursor that should take about 10 minutes, we are getting an ORA-03113 error in php_cli_error.log

However, the exact same docker image completes the same program without errors when running on docker on linux, connecting to the same Oracle server.

Is there any known differences between running oracle client with php on docker on linux vs windows 10 ?

We are using instantclient_19_6 and php 7.4, windows 10 build 2004, docker desktop.

All the machines are on the same internal network, so not network issues.

I have checked the Oracle alert.log file and there are no errors there, so it does not appear that the Oracle server is triggering the error. It looks more like something is terminating the connection on the client end.

Here is the dockerfile oracle install section

# Install Oracle Connector Client
# Refer Here - https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e
RUN mkdir /opt/oracle && \
    cd /opt/oracle && \
    mv /tmp/instantclient-* /opt/oracle/ && \
    unzip instantclient-basiclite-linux.x64-19.6.0.0.0dbru.zip && \
    unzip instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip && \
    echo /opt/oracle/instantclient_19_6 > /etc/ld.so.conf.d/oracle-instantclient.conf && \
    ldconfig && \
    apt-get -y install php7.4-dev php-pear build-essential libaio1 && \
    pecl channel-update pecl.php.net && \
    echo 'instantclient,/opt/oracle/instantclient_19_6' | pecl install oci8 && \
    echo "extension = oci8.so" >> /etc/php/7.4/cli/php.ini && \
    echo "extension = oci8.so" >> /etc/php/7.4/apache2/php.ini && \
    echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6" >> /etc/apache2/envvars && \
    echo "export ORACLE_HOME=/opt/oracle/instantclient_19_6" >> /etc/apache2/envvars && \
    echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6:$LD_LIBRARY_PATH" >> /etc/environment && \
    rm -v /opt/oracle/instantclient-* && \
    apt-get -y remove --purge php7.4-dev build-essential && \
    apt-get -y autoremove

Any ideas what might be causing the oracle connection to get terminated ?

p.s. I have also tried running the php program using nohup to ensure its not a signal interrupt, still the error occurs.

More Info - I have turned on ADR tracing for instaclient in the docker instance and this is what is in the trace file when it happens

2020-06-30 20:02:10.452 : ntt2err:entry
2020-06-30 20:02:10.452 : ntt2err:Read unexpected EOF ERROR on 7
2020-06-30 20:02:10.453 : ntt2err:exit
2020-06-30 20:02:10.453 : nttfprd:exit
2020-06-30 20:02:10.453 : nserror:nsres: id=0, op=68, ns=12537, ns2=12560; nt[0]=507, nt[1]=0, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
2020-06-30 20:02:10.453 : nioqer:entry
2020-06-30 20:02:10.453 : nioqce:entry
2020-06-30 20:02:10.453 : nioqce:exit
2020-06-30 20:02:10.453 : nioqer:exit
2020-06-30 20:02:10.453 : nioqrc:exit
2020-06-30 20:02:10.453 : nioqds:entry
2020-06-30 20:02:10.453 : nioqds: disconnecting...
2020-06-30 20:02:10.453 : nsvntx_dei:entry
2020-06-30 20:02:10.453 : nsvntx_dei:exit
2020-06-30 20:02:10.453 : nstimarmed:no timer allocated
2020-06-30 20:02:10.453 : nttctl:entry
2020-06-30 20:02:10.453 : nttctl:entry
2020-06-30 20:02:10.453 : nsfull_cls:cid=0, opcode=65, *bl=0, *what=0, uflgs=0x0, cflgs=0x0
2020-06-30 20:02:10.453 : nsfull_cls:nsctx: state=1, flg=0x4009, mvd=117
2020-06-30 20:02:10.453 : nsdo:cid=0, opcode=67, *bl=0, *what=1, uflgs=0x0, cflgs=0x1
2020-06-30 20:02:10.453 : nsdo:nsctx: state=1, flg=0x4009, mvd=117
2020-06-30 20:02:10.453 : nsclose:closing transport
2020-06-30 20:02:10.453 : nttdisc:entry
2020-06-30 20:02:10.453 : nttdisc:Closed socket 7
2020-06-30 20:02:10.453 : nttdisc:exit
2020-06-30 20:02:10.453 : nsclose:global context check-out (from slot 0) complete
2020-06-30 20:02:10.453 : nadisc:entry
2020-06-30 20:02:10.453 : nacomtm:entry
2020-06-30 20:02:10.453 : nacompd:entry
2020-06-30 20:02:10.453 : nacompd:exit
2020-06-30 20:02:10.453 : nacompd:entry
2020-06-30 20:02:10.453 : nacompd:exit
2020-06-30 20:02:10.453 : nacomtm:exit
2020-06-30 20:02:10.453 : nas_dis:entry
2020-06-30 20:02:10.453 : nas_dis:exit
2020-06-30 20:02:10.453 : nau_dis:entry
2020-06-30 20:02:10.453 : nau_dis:exit
2020-06-30 20:02:10.453 : naeetrm:entry
2020-06-30 20:02:10.453 : naeetrm:exit
2020-06-30 20:02:10.453 : naectrm:entry
2020-06-30 20:02:10.453 : naectrm:exit
2020-06-30 20:02:10.453 : nagbltrm:entry
2020-06-30 20:02:10.453 : nau_gtm:entry
2020-06-30 20:02:10.453 : nau_gtm:exit
2020-06-30 20:02:10.453 : nagbltrm:exit
2020-06-30 20:02:10.453 : nadisc:exit
2020-06-30 20:02:10.453 : nsvntx_dei:entry
2020-06-30 20:02:10.453 : nsvntx_dei:exit
2020-06-30 20:02:10.453 : nsmfr:3368 bytes at 0x55dbab934a30
2020-06-30 20:02:10.453 : nsmfr:150 bytes at 0x55dbab761b20
2020-06-30 20:02:10.453 : nsmfr:288 bytes at 0x55dbab932a50
2020-06-30 20:02:10.453 : nladtrm:entry
2020-06-30 20:02:10.453 : nladtrm:exit
2020-06-30 20:02:10.453 : nsmfr:1952 bytes at 0x55dbab934280
2020-06-30 20:02:10.453 : nigcui:entry
2020-06-30 20:02:10.453 : nigcui:Clr User Interrupt: hdl=0, prc=0x573b4510, ctx=0xab920500.
2020-06-30 20:02:10.453 : nioqds:exit
2020-06-30 20:02:10.453 : nigtrm:Count in the NI global area is now 2
2020-06-30 20:02:10.453 : nsbrfr:nsbfs at 0xab93c560, data at 0xab935970.
2020-06-30 20:02:10.453 : nsbrfr:nsbfs at 0xab93e700, data at 0xab93e7b0.
2020-06-30 20:02:10.453 : nsbrfr:nsbfs at 0xab933f60, data at 0xab93c610.
2020-06-30 20:02:10.453 : nsbrfr:nsbfs at 0xab9408a0, data at 0xab940b40.
2020-06-30 20:02:10.453 : nsbrfr:nsbfs at 0xab933e00, data at 0xab942c30.
2020-06-30 20:02:10.453 : nigtrm:Count in the NL global area is now 2

Also tried increasing timeouts in sqlnet.ora on client.

TRACE_LEVEL_CLIENT=admin
DIAG_ADR_ENABLED=on
ADR_BASE=/tmp/mydiag
DEFAULT_SDU_SIZE=1024
SQLNET.INBOUND_CONNECT_TIMEOUT=100
SQLNET.OUTBOUND_CONNECT_TIMEOUT=100
SQLNET.RECV_TIMEOUT=1000
SQLNET.SEND_TIMEOUT=100
TCP.CONNECT_TIMEOUT=100
BEQUEATH_DETACH=yes
DISABLE_OOB=on

Thanks Peter

1

1 Answers

0
votes

A couple of notes:

Regarding your actual error, it's best to look for Oracle trace files on the DB and in the container. Are there any oradiag_* directories in the container? If you can't find any, create /opt/oracle/instantclient_19_6/network/admin/sqlnet.ora with some entry like ADR_BASE=/tmp/mydiag and then run mkdir /tmp/mydiag before starting your app.