Forum Stats

  • 3,759,178 Users
  • 2,251,510 Discussions
  • 7,870,526 Comments

Discussions

SIGSEGV on Instantclient 12.2+ (18.5, 19.6) with OCI8-2.2.0

Stanislav Studený
Stanislav Studený Member Posts: 60 Bronze Badge
edited Jul 1, 2020 2:33AM in PHP

Hello.

I'm facing strange problems with 19.6. instant client and OCI8 2.2.0 + PHP 7.2.24 on OL7 x86-64, but the same can be produced with 12.2+ instantclient. Some SQL called from php are failing due to instantclient SIGSEGV :

oci-24550 [11] [[si_signo=11] [si_errno=0] [si_code=1] [si_int=381] [si_ptr=0x17d] [si_addr=0xffffffef]] [] [] [] [] [] [] [] [] [] []

Shortstack:

php_execute_script()+736 -> zend_execute_scripts()+195 -> zend_execute()+307 -> execute_ex()+394 -> zif_oci_execute()+106 oci8_interface.c:1405 -> php_oci_statement_execute()+194 oci8_statement.c:556 -> OCIStmtExecute()+41 -> kpuexec()+10079 -> kpurcsc()+100 -> upirtrc()+1522 -> nioqwa()+61 -> ttcdrv()+1315 -> ttcacs()+2581 -> ttcGetSendInfo()+1009 -> __intel_ssse3_rep_memcpy()+6710 [SIGSEGV]

Has anyone faced this problem?

With 12.1.0.2 instant client is all OK.

Best Regards,

Stanislav

«1

Comments

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,643 Employee
    edited Jun 19, 2020 3:56AM

    I haven't seen it.  Do you have any trace files in some oradiag_xxxx directory?  I generally set the log directory by adding something like this to my sqlnet.ora file:

         adr_base=/tmp/mylogs

    and then run 'mkdir /tmp/mylogs' before running my application

    Does it happen on multiple machines?

    Do you have a complete, runnable test case that you can share?

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge
    edited Jun 19, 2020 4:35AM

    Hi.

    Sure, I'll provide all detailed traces from instantclient's SIGSEGV handler.

    I'm working on reproducible (minimal) testcase.

    All our web cluster machines are affected.

    Stanislav

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge
    edited Jun 19, 2020 4:47AM
  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,643 Employee
    edited Jun 19, 2020 8:14PM

    What's the PHP configuration? Do you have a reproducible test case?

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge
    edited Jun 22, 2020 4:09AM

    Hi.

    Phpinfo here : https://drive.google.com/file/d/1cpwdNarX4AR6ejKE2BBT1AvzBhPmbHAx/view?usp=sharing

    I'm still working on reproductible and public testcase. Codebase is quite big and I need to minimize to be as small as possible. Running simple single SQL (which is failing) is not sufficient, because it doesn't reproduce problem. It looks like several conditions must be met and also identified to provide successfull testcase.

    Regards,

    Stanislav

  • vansul
    vansul Member Posts: 438
    edited Jul 1, 2020 2:33AM

    Try over php 7.1, may be issue with the compatibility. as its working fine with php 7.1 so Downgrade PHP 7.2 to 7.1

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge
    edited Feb 12, 2021 9:29AM

    Okay, after some time of settling down here is the testcase. Actually it's about binding NULL.

    It will SIGSEGV all clients (instant and full) from version 12.2. to 21.1.

    Reported in SR 3-25065306931 : 19.9. Instantclient SIGSEGV (__intel_ssse3_rep_memcpy) @ libclntsh.so.19.1



    putenv("ORACLE_BASE=/u01/app/oracle");

    putenv("LD_LIBRARY_PATH=/u01/app/oracle/client/lib:/usr/lib:/lib");

    putenv("ORACLE_HOME=/u01/app/oracle/client");

    putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8");

    putenv("NLS_SORT=BINARY");

    putenv("TNS_ADMIN=/u01/app/oracle/client/network/admin");

    putenv("ORA_CLIENTTRACE_DIR=/tmp");

    putenv("EVENT_10842=server=all;user=W3;stmt=all;level=15");


    $per_id = null;


    $sql = "SELECT count(*) FROM dual WHERE (:p_per_id IS NULL OR X = :p_per_id) AND :p_right_level_code = 'RA'";

    $bax = array(

    'p_per_id' => $per_id

    ,'p_right_level_code' => 'RA'

    );


    $connection = oci_pconnect('DB_USERNAME', 'DB_PASSWORD', 'POOLED_DB_DSN', 'AL32UTF8');

    if ($connection === false) {

    if (isset($connection)) {

    $error = oci_error($connection);

    } else {

    $error = oci_error();

    }

    die("ERROR connection : $error");

    }


    $ociStatement = oci_parse($connection, $sql);

    if ($ociStatement === false) {

    $error = oci_error($connection);


    oci_close($connection);

    $connection = null;


    die("oci_prepare error: $error");

    }


    foreach ($bax as $param => &$value) {

    if (!oci_bind_by_name($ociStatement, $param, $value, -1, SQLT_CHR )) {

    $error = oci_error($ociStatement);


    oci_free_statement($ociStatement);

    oci_close($connection);

    $connection = null;


    die("oci_bin_by_name error: $error");

    }

    }


    if (!oci_execute($ociStatement, OCI_NO_AUTO_COMMIT)) {

    $error = oci_error($ociStatement);


    oci_free_statement($ociStatement);

    oci_close($connection);

    $connection = null;


    die("oci_execute error: $error");

    }


    oci_free_statement($ociStatement);

    oci_close($connection);

    $connection = null;

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge

    Failing stacktrace is always :

    #0 0x00007f6fc9838fe6 __intel_ssse3_rep_memcpy (libclntsh.so.21.1)

    #1 0x00007f6fca180a66 ttcGetSendInfo (libclntsh.so.21.1)

    #2 0x00007f6fcb93ee6f ttcacs (libclntsh.so.21.1)

    #3 0x00007f6fcb93fb75 ttcdrv (libclntsh.so.21.1)

    #4 0x00007f6fcb90c1bd nioqwa (libclntsh.so.21.1)

    #5 0x00007f6fcb8de645 upirtrc (libclntsh.so.21.1)

    #6 0x00007f6fcb8f14c1 kpurcsc (libclntsh.so.21.1)

    #7 0x00007f6fcb8e2d3b kpuexec (libclntsh.so.21.1)

    #8 0x00007f6fcb8ddd69 OCIStmtExecute (libclntsh.so.21.1)

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge

    PHP 7.2 + OCI8 2.2.0

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,643 Employee
    • Don't set Oracle environment variables in the script. Behavior can be undefined, e.g. https://stackoverflow.com/questions/66006203/php-putenv-return-inconsistent-value/66017553#66017553
    • LD_LIBRARY_PATH is not read after the process starts on Linux. Make sure you really have a clean environment.
    • Your SQL statement gives: PHP Warning: oci_execute(): ORA-00904: "X": invalid identifier
    • If I change the SQL to use 'X' I don't see any crash with Instant Client 21.1 on Linux - and a fetch returns 1.