Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.943 2006/10/25 08:04:18 noring Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.944 2006/10/27 15:58:38 mast Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:5079:   #else    report_debug("Describing single thread:\n%s\n",    describe_backtrace (backtrace()));   #endif      #ifdef DEBUG    report_debug (RoxenDebug.report_leaks());   #endif   }    +  + // Dump threads by file polling. +  + constant cdt_poll_interval = 5; // Seconds. + constant cdt_dump_seq_interval = 60; +  + string cdt_directory, cdt_filename; +  + Thread.Thread cdt_thread; + int cdt_next_seq_dump; +  + void cdt_poll_file() + { +  while (this && query ("dump_threads_by_file")) { +  if (array(string) dir = r_get_dir (cdt_directory)) { +  if (has_value (dir, cdt_filename)) { +  r_rm (cdt_directory + "/" + cdt_filename); +  describe_all_threads(); +  } +  else if (time() >= cdt_next_seq_dump) { +  dir = glob (cdt_filename + ".*", dir); +  if (sizeof (dir)) { +  string file = dir[0]; +  r_rm (cdt_directory + "/" + file); +  describe_all_threads(); +  sscanf (file, cdt_filename + ".%d", int count); +  if (--count > 0) { +  open (cdt_directory + "/" + cdt_filename + "." + count, +  "cwt"); +  cdt_next_seq_dump = time (1) + cdt_dump_seq_interval; +  } +  } +  } +  } +  sleep (cdt_poll_interval); +  } +  cdt_thread = 0; + } +  + void cdt_changed (Variable v) + { +  if (cdt_directory && v->query() && !cdt_thread) +  cdt_thread = Thread.thread_create (cdt_poll_file); + } +  + // ---------------------------------------- +  +    constant dump = roxenloader.dump;      program slowpipe, fastpipe;      void initiate_argcache()   {    int t = gethrtime();    report_debug( "Initiating argument cache ... \b");    if( mixed e = catch( argcache = ArgCache("arguments") ) )    {
Roxen.git/server/base_server/roxen.pike:5337: Inside #if defined(ENABLE_SIGWINCH)
  #ifdef ENABLE_SIGWINCH    "SIGWINCH",   #endif    }), string sig)    catch( signal(signum(sig),async_sig_start(describe_all_threads,-1)));       start_time=time(); // Used by the "uptime" info later on.       restart_suicide_checker();    +  { +  array(string) splitdir = roxen_path ("$LOGFILE") / "/"; +  cdt_filename = splitdir[-1]; +  cdt_directory = splitdir[..sizeof (splitdir) - 2] * "/"; +  if (has_suffix (cdt_filename, ".1")) +  cdt_filename = cdt_filename[..sizeof (cdt_filename) - 3]; +  cdt_filename += ".dump_threads"; +  cdt_changed (getvar ("dump_threads_by_file")); +  } +    #ifdef ROXEN_DEBUG_MEMORY_TRACE    restart_roxen_debug_memory_trace();   #endif      #ifndef __NT__    restart_if_stuck( 0 );   #endif   #ifdef __RUN_TRACE    trace(1);   #endif