4 Replies Latest reply: Jul 30, 2013 2:24 PM by jchristian RSS

    OCCI connect is masking my signals, what am I doing wrong?

    EricHoltman

      Sample app, sqlnet.ora and traces included below.

       

      Basically, when I run the sample app with no args (so there's no connection), Ctrl-C still works from my terminal window.

       

      If I run with any argument (so it connects), then Ctrl-C (SIGINT) is masked.

       

      I've read up on DIAG_SIGHANDLER_ENABLED, and I've st up everything so that I can configure it.

       

      Yet OCCI still eats my signals.

       

      Any help?

       

       

       

       

      I've got the sqlnet.ora set up like so:

       

      # sqlnet.ora Network Configuration File: /appl/pm/vendor/oracle/lx-x86_64/product/11.2.0/client_1/network/admin/sqlnet.ora
      # Generated by Oracle configuration tools.

      NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


      #SQLNET.AUTHENTICATION_SERVICES = (NTS)
      #sqlnet.authentication_kerberos5_service=host

      #sqlnet.kerberos5_conf=/home/bbalasay/TNS_HOME/krb5.conf
      #sqlnet.authentication_services=(kerberos5,all)
      #sqlnet.kerberos5_clockskew=6000
      #sqlnet.kerberos5_conf_mit=TRUE
      #sqlnet.kerberos5_keytab=/etc/krb5.keytab

      DIAG_SIGHANDLER_ENABLED=FALSE
      BEQUEATH_DETACH=YES
      DIAG_DDE_ENABLED=FALSE
      DIAG_ADR_ENABLED=FALSE

      TRACE_DIRECTORY_CLIENT=/home/eholtman/TNS_HOME/traces
      TRACE_FILE_CLIENT=cli_solaris.trc
      #TRACE_FILE_CLIENT=cli_linux.trc
      TRACE_LEVEL_CLIENT=4

       

      I've verified that my little test program is reading that sqlnet.ora, here's the trace:

       

      (1) [25-JUL-2013 11:54:09:124] Attempted load of local pfile source /home/eholtman/.sqlnet.ora

      (1) [25-JUL-2013 11:54:09:124] Parameter source was not loaded

      (1) [25-JUL-2013 11:54:09:124]

      (1) [25-JUL-2013 11:54:09:124]  -> PARAMETER TABLE LOAD RESULTS FOLLOW <-

      (1) [25-JUL-2013 11:54:09:124] Successful parameter table load

      (1) [25-JUL-2013 11:54:09:124]  -> PARAMETER TABLE HAS THE FOLLOWING CONTENTS <-

      (1) [25-JUL-2013 11:54:09:124]   DIAG_SIGHANDLER_ENABLED = FALSE

      (1) [25-JUL-2013 11:54:09:124]   TRACE_DIRECTORY_CLIENT = /home/eholtman/TNS_HOME/traces

      (1) [25-JUL-2013 11:54:09:124]   DIAG_DDE_ENABLED = FALSE

      (1) [25-JUL-2013 11:54:09:124]   BEQUEATH_DETACH = YES

      (1) [25-JUL-2013 11:54:09:124]   NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)

      (1) [25-JUL-2013 11:54:09:124]   TRACE_LEVEL_CLIENT = 4

      (1) [25-JUL-2013 11:54:09:124]   TRACE_FILE_CLIENT = cli_solaris.trc

      (1) [25-JUL-2013 11:54:09:124]   DIAG_ADR_ENABLED = FALSE

       

      here's the sample code:

       

       

      #include <iostream>

      #include <occi.h>

      int
      main (int argc, char **argv)
      {
          using namespace oracle::occi;

          if (argc > 1) {
              int mode = Environment::THREADED_UNMUTEXED | OCI_OBJECT;

              Environment *_env = Environment::createEnvironment ((Environment::Mode) mode);

              std::string uid = "*******";
              std::string password = "**************";
              std::string dbname = "*******";
              Connection *_oracleConn = _env->createConnection(uid, password, dbname);
          }

          std::cout << "Waiting: " << std::flush;
          std::string s;
          std::cin >> s;


          std::cout << "Done!" << std::endl;
          return 0;
      }


        • 1. Re: OCCI connect is masking my signals, what am I doing wrong?
          jchristian

          I don't see any signal handling code in the snippet above.  Is that something that OCCI handles?  I think you may be depending on some sort of default behavior if you haven't defined a function to handle signals.  I would suggest a signal handler that you write to explicitly ensure cleanup of resources if you get a control-C.  I would at least try to ensure the connection is closed if it has been opened.  Come to think of it, I don't see the code where the resources are freed during normal operation... Is that optional?

          • 2. Re: OCCI connect is masking my signals, what am I doing wrong?
            EricHoltman

            That's the root of my question.

             

            I'm not doing *any* singal handling, but if I call Oracle's createConnection() function, it silently eats my signals.

             

            And I didn't include any cleanup because it's just a demo program.

            • 3. Re: OCCI connect is masking my signals, what am I doing wrong?
              jchristian

              Hi Eric,


              Then my response is to add a signal handler so you can see what's happening when you do a ctrl-C.  I'd also make sure to clean up resources even for a demo.  I'd think this would take a couple of minutes, and then you'd have a better idea of what's happening in the program.

               

              Cheers,

               

              JC

              • 4. Re: OCCI connect is masking my signals, what am I doing wrong?
                EricHoltman

                I don't think you're understanding the issue.

                 

                If I run that program without specifying an argument, it works exactly as I expect:   Ctrl-C generates a SIGINT which kills the program.

                 

                If I run it with an argument (so that OCCI is called), Ctrl-C is masked out.  

                 

                That's the issue:   I don't *want* Oracle to be mucking with the signals.

                 

                I don't want to add signal handling code.  I want as small a test case as possible.

                 

                I don't want to add cleanup code.  (a) I want as small a test case as possible   (b) The code (either way) never gets to the cleanup.