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 - 2001, 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.872 2004/05/04 15:02:35 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.873 2004/05/07 14:41:21 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:618: Inside #if defined(THREADS) and #if defined(TEST_EUID_CHANGE)
   if (test_euid_change) {    Stdio.File f = Stdio.File();    if (f->open ("rootonly", "r") && f->read())    werror ("Handler thread %d can read rootonly\n", id);    else    werror ("Handler thread %d can't read rootonly\n", id);    }   #endif    while(1)    { +  int thread_flagged_as_busy;    if(q=catch {    do {   // if (!busy_threads) werror ("GC: %d\n", gc());    THREAD_WERR("Handle thread ["+id+"] waiting for next event");    if(arrayp(h=handle_queue->read()) && h[0]) {    THREAD_WERR(sprintf("Handle thread [%O] calling %O(%{%O, %})",    id, h[0], h[1] / 1));    set_locale();    busy_threads++; -  +  thread_flagged_as_busy = 1;    h[0](@h[1]);    h=0;    busy_threads--; -  +  thread_flagged_as_busy = 0;    } else if(!h) {    // Roxen is shutting down.    report_debug("Handle thread ["+id+"] stopped.\n");    thread_reap_cnt--;   #ifdef NSERIOUS    if(!thread_reap_cnt) report_debug("+++ATH\n");   #endif    return;    }   #ifdef DEBUG
Roxen.git/server/base_server/roxen.pike:661: Inside #if defined(THREADS)
   // have an extra ref to the mutex since the MutexKey    // doesn't keep one.)    Thread.Mutex m = Thread.Mutex();    cond->wait (m->lock());    }    threads_on_hold--;    THREAD_WERR("Handle thread [" + id + "] released");    }    } while(1);    }) { +  if (thread_flagged_as_busy) +  busy_threads--;    if (h = catch {    report_error(/*LOCALE("", "Uncaught error in handler thread: %s"    "Client will not get any response from Roxen.\n"),*/    describe_backtrace(q));    if (q = catch {h = 0;}) {    report_error(LOC_M(5, "Uncaught error in handler thread: %sClient "    "will not get any response from Roxen.")+"\n",    describe_backtrace(q));    catch (q = 0);    }
Roxen.git/server/base_server/roxen.pike:1417:    //! Given a url and requestid, try to locate a suitable configuration    //! (virtual site) for the request.    //! This interface is not at all set in stone, and might change at    //! any time.    {    Configuration c;    if( sizeof( urls ) == 1 && !no_default)    {    if(!mu) mu=urls[sorted_urls[0]];    INIT( mu ); -  URL2CONF_MSG ("%O %O cached: %O\n", this_object(), url, c); +  URL2CONF_MSG ("%O %O Only one configuration: %O\n", this_object(), url, c);    return c;    } else if (!sizeof(sorted_urls)) {    URL2CONF_MSG("%O %O No active URLS!\n", this_object(), url);    return 0;    }       url = lower_case( url );    URL2CONF_MSG("sorted_urls: %O\n"    "url: %O\n", sorted_urls, url);    // The URLs are sorted from longest to shortest, so that short
Roxen.git/server/base_server/roxen.pike:4397:    }       report_debug ("### Total %d Pike threads\n", sizeof (threads));       threads = 0;    threads_disabled = 0;   #else    report_debug("Describing single thread:\n%s\n",    describe_backtrace (backtrace()));   #endif +  +  report_debug (RoxenDebug.report_leaks());   }      constant dump = roxenloader.dump;      program slowpipe, fastpipe;      void initiate_argcache()   {    int t = gethrtime();    report_debug( "Initiating argument cache ... \b");
Roxen.git/server/base_server/roxen.pike:4439: Inside #if defined(TIMERS)
   reverse(a);    reverse(b);    report_notice("Timers:\n");    for( int i = 0; i<sizeof(b); i++ )    report_notice( " %-30s : %10.1fms\n", b[i], a[i]/1000.0 );    report_notice("\n\n");   }   #endif       + class GCTimestamp + { +  array self_ref; +  static void create() {self_ref = ({this_object()});} +  static void destroy() { +  werror ("GC runs at %s", ctime(time())); +  GCTimestamp(); +  } + } +  +    array argv;   int main(int argc, array tmp)   {    // __builtin.gc_parameters((["enabled": 0]));    argv = tmp;    tmp = 0;    -  + #ifdef LOG_GC_TIMESTAMPS +  GCTimestamp(); + #endif +     // For RBF    catch(mkdir( "../var" ));       dbm_cached_get = master()->resolv( "DBManager.cached_get" );       dbm_cached_get( "local" )->    query( "CREATE TABLE IF NOT EXISTS "    "compiled_formats ("    " md5 CHAR(32) not null primary key,"    " full BLOB not null,"
Roxen.git/server/base_server/roxen.pike:4925:   // compilation information.   //   // ({ command_sscanf_string, number_of_arguments, actual_tests,   // state_symbol_string,   // })   //      // In the tests array the following types has the following meaning:   // function   // The function will be run during compilation. It gets the values - // aquired though sscanf-ing the command as input and should return + // acquired through sscanf-ing the command as input and should return   // an array with corresponding data.   // string   // The string will be compiled into the actual test code. It is   // first modified as   // str = sprintf(str, @args)   // where args are the arguments from the command after it has been   // processed by the provided function, if any.   // multiset   // Strings in a multiset will be added before the string above.   // should typically be used for variable declarations.   // int   // Signals that an authentication request should be sent to the user   // upon failure.   //   //   // NOTE: It's up to the security checks in this file to ensure that   // nothing is overcached. All patterns that perform checks using   // information from the client (such as remote address, referer etc) - // _have_ to use NOCACHE() or NO_PROTO_CACHE(). It's not nessesary, however, + // _have_ to use NOCACHE() or NO_PROTO_CACHE(). It's not necessary, however,   // to do that for checks that use the authentication module API, since   // then it's up to the user database and authentication modules to ensure   // that nothing is overcached in that case.   array(array(string|int|array)) security_checks = ({    ({ "ip=%s:%s",2,({    lambda( string a, string b ){    int net = Roxen.ip_to_int( a );    int mask = Roxen.ip_to_int( b );    net &= mask;    return ({ net, sprintf("%c",mask)[0] });