Logo Search packages:      
Sourcecode: condor version File versions  Download package

void DaemonCore::reconfig ( void   ) 

Re-read anything that the daemonCore object got from the config file that might have changed on a reconfig.

Definition at line 2291 of file daemon_core.cpp.

References Cancel_Timer(), getSecMan(), initCollectorList(), InitSettableAttrsLists(), Register_Timer(), Reset_Timer(), MyString::sprintf(), and MyString::Value().

                         {
      // NOTE: this function is always called on initial startup, as well
      // as at reconfig time.

      // NOTE: on reconfig, refreshDNS() will have already been called
      // by the time we get here, because it needs to be called early
      // in the process.

      SecMan *secman = getSecMan();
      secman->reconfig();

            // add a random offset to avoid pounding DNS
      int dns_interval = param_integer("DNS_CACHE_REFRESH",
                                                       8*60*60+(rand()%600), 0);
      if( dns_interval > 0 ) {
            if( m_refresh_dns_timer < 0 ) {
                  m_refresh_dns_timer =
                        Register_Timer( dns_interval, dns_interval,
                                                (Eventcpp)&DaemonCore::refreshDNS,
                                                "DaemonCore::refreshDNS()", daemonCore );
            } else {
                  Reset_Timer( m_refresh_dns_timer, dns_interval, dns_interval );
            }
      }
      else if( m_refresh_dns_timer != -1 ) {
            daemonCore->Cancel_Timer( m_refresh_dns_timer );
            m_refresh_dns_timer = -1;
      }

      // Maximum number of bytes read from a stdout/stderr pipes.
      // Default is 10k (10*1024 bytes)
      maxPipeBuffer = param_integer("PIPE_BUFFER_MAX", 10240);

            // Grab a copy of our private network name (if any).
      if (m_private_network_name) {
            free(m_private_network_name);
      }
      m_private_network_name = param("PRIVATE_NETWORK_NAME");

            // Initialize the collector list for ClassAd updates
      initCollectorList();

            // Initialize the StringLists that contain the attributes we
            // will allow people to set with condor_config_val from
            // various kinds of hosts (ADMINISTRATOR, CONFIG, WRITE, etc). 
      InitSettableAttrsLists();

#if HAVE_CLONE
    if (param_boolean("NET_REMAP_ENABLE", false, false)) {
            m_use_clone_to_create_processes = false;
            dprintf(D_CONFIG, "NET_REMAP_ENABLE is TRUE, forcing USE_CLONE_TO_CREATE_PROCESSES to FALSE.\n");
      }
      else {
            m_use_clone_to_create_processes = param_boolean("USE_CLONE_TO_CREATE_PROCESSES", true);
      }
#if defined(HAVE_VALGRIND_H)
      if (RUNNING_ON_VALGRIND) {
            dprintf(D_ALWAYS, "Looks like we are under valgrind, forcing USE_CLONE_TO_CREATE_PROCESSES to FALSE.\n");
            m_use_clone_to_create_processes = false;
      }
#endif

#endif /* HAVE CLONE */

      m_invalidate_sessions_via_tcp = param_boolean("SEC_INVALIDATE_SESSIONS_VIA_TCP", true);

#ifdef HAVE_EXT_GSOAP
      if( param_boolean("ENABLE_SOAP",false) ||
            param_boolean("ENABLE_WEB_SERVER",false) )
      {
                  // Only allocate soap structure if we need it, because
                  // it is big.
            if( !soap ) {
                  soap = new struct soap;
                        // SETUP SOAP SOCKET
                  init_soap(soap);
            }
      }
      else {
            // Do not have to deallocate soap if it was enabled and has
            // now been disabled.  Access to it will be disallowed, even
            // though the structure is still allocated.
      }
#endif
#ifdef HAVE_EXT_GSOAP
#ifdef COMPILE_SOAP_SSL
      MyString subsys = MyString(get_mySubSystem()->getName());
      bool enable_soap_ssl = param_boolean("ENABLE_SOAP_SSL", false);
      bool subsys_enable_soap_ssl =
            param_boolean((subsys + "_ENABLE_SOAP_SSL").GetCStr(), false);
      if (subsys_enable_soap_ssl ||
            (enable_soap_ssl &&
             (!(NULL != param((subsys + "_ENABLE_SOAP_SSL").GetCStr())) ||
              subsys_enable_soap_ssl))) {
            if (mapfile) {
                  delete mapfile; mapfile = NULL;
            }
            mapfile = new MapFile;
            char * credential_mapfile;
            if (NULL == (credential_mapfile = param("CERTIFICATE_MAPFILE"))) {
                  EXCEPT("DaemonCore: No CERTIFICATE_MAPFILE defined, "
                           "unable to identify users, required by ENABLE_SOAP_SSL");
            }
            char * user_mapfile;
            if (NULL == (user_mapfile = param("USER_MAPFILE"))) {
                  EXCEPT("DaemonCore: No USER_MAPFILE defined, "
                           "unable to identify users, required by ENABLE_SOAP_SSL");
            }
            int line;
            if (0 != (line = mapfile->ParseCanonicalizationFile(credential_mapfile))) {
                  EXCEPT("DaemonCore: Error parsing CERTIFICATE_MAPFILE at line %d",
                           line);
      }
            if (0 != (line = mapfile->ParseUsermapFile(user_mapfile))) {
                  EXCEPT("DaemonCore: Error parsing USER_MAPFILE at line %d", line);
            }
      }
#endif // COMPILE_SOAP_SSL
#endif // HAVE_EXT_GSOAP


            // FAKE_CREATE_THREAD is an undocumented config knob which turns
            // Create_Thread() into a simple function call in the main process,
            // rather than a thread/fork.
#ifdef WIN32
            // Currently, all use of threads are deemed unsafe in Windows.
      m_fake_create_thread = param_boolean("FAKE_CREATE_THREAD",true);
#else
            // Under unix, Create_Thread() is actually a fork, so it is safe.
      m_fake_create_thread = param_boolean("FAKE_CREATE_THREAD",false);
#endif

      // Setup a timer to send child keepalives to our parent, if we have
      // a daemon core parent.
      if ( ppid && m_want_send_child_alive ) {
            MyString buf;
            buf.sprintf("%s_NOT_RESPONDING_TIMEOUT",get_mySubSystem()->getName());
            max_hang_time = param_integer(buf.Value(),-1);
            if( max_hang_time == -1 ) {
                  max_hang_time = param_integer("NOT_RESPONDING_TIMEOUT",0);
            }
            if ( !max_hang_time ) {
                  max_hang_time = 60 * 60;      // default to 1 hour
            }
            int send_update = (max_hang_time / 3) - 30;
            if ( send_update < 1 )
                  send_update = 1;
            if ( send_child_alive_timer == -1 ) {

                        // 2008-06-18 7.0.3: commented out direct call to
                        // SendAliveToParent(), because it causes deadlock
                        // between the shadow and schedd if the job classad
                        // that the schedd is writing over a pipe to the
                        // shadow is larger than the pipe buffer size.
                        // For now, register timer for 0 seconds instead
                        // of calling SendAliveToParent() immediately.
                        // This means we are vulnerable to a race condition,
                        // in which we hang before the first CHILDALIVE.  If
                        // that happens, our parent will never kill us.

                  send_child_alive_timer = Register_Timer(0, (unsigned)send_update,
                              (TimerHandlercpp)&DaemonCore::SendAliveToParent,
                              "DaemonCore::SendAliveToParent", this );

                        // Send this immediately, because if we hang before
                        // sending this message, our parent will not kill us.
                        // (Commented out.  See reason above.)
                        // SendAliveToParent();
            } else {
                  Reset_Timer(send_child_alive_timer, 1, send_update);
            }
      }

      file_descriptor_safety_limit = 0; // 0 indicates: needs to be computed

}


Generated by  Doxygen 1.6.0   Back to index