Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:3980:    if( !meta || !data )    error("Invalid reply mapping.\n"    "Expected ([ \"meta\": ([metadata]), \"data\":\"data\" ])\n"    "Got %O\n", reply);    }   #ifdef ARG_CACHE_DEBUG    werror("draw %O done\n", name );   #endif    // Avoid throwing and error if the same image is rendered twice.    mixed err = catch(store_data( name, data, meta )); +  if (objectp (err) && err->is_RXML_Backtrace && RXML_CONTEXT) { +  throw (err); +  }   #ifdef ARG_CACHE_DEBUG    if (err) {    werror("store_data failed with:\n"    "%s\n", describe_backtrace(err));    }   #endif    }       protected void store_data( string id, string data, mapping meta )    {    if(!stringp(data)) return;   #ifdef ARG_CACHE_DEBUG    werror("store %O (%d bytes)\n", id, strlen(data) );   #endif -  +  // Since 134217728 (2^27) is the largest number we can give as argument to +  // the SQL-function "SPACE()", we cannot store images larger than 2^27 bytes +  // even though the size of the data-column allows 4294967295 bytes. +  if (sizeof(data) > 134217728) { // 134217728 = 2^27 +  RXML.run_error("Generated image data (%f MB) exceeds max limit of " +  "128 MB.\n", (float) sizeof(data) / 1024 / 1024 ); +  }    meta_cache_insert( id, meta );    string meta_data = encode_value( meta );   #ifdef ARG_CACHE_DEBUG    werror("Replacing entry for %O\n", id );   #endif    if (sizeof(data) <= 8*1024*1024) {    // Should fit in the 16 MB query limit without problem.    // Albeit it might trigger a slow query entry for large    // entries.    QUERY("REPLACE INTO " + name +
Roxen.git/server/base_server/roxen.pike:4310: Inside #if defined(ARG_CACHE_DEBUG)
  #ifdef ARG_CACHE_DEBUG    werror("data: %O id: %O\n", na, id );   #endif    if(! (res=restore( na,id )) )    {    mixed err;    if (nodraw || (err = catch {    if (mapping res = draw( na, id ))    return res;    })) { -  if (objectp (err) && err->is_RXML_Backtrace && !RXML_CONTEXT) { + #ifdef ARG_CACHE_DEBUG +  werror("draw() failed with error: %s\n", +  describe_backtrace(err)); + #endif +  if (objectp (err) && err->is_RXML_Backtrace) { +  if (RXML_CONTEXT) { + #ifdef ARG_CACHE_DEBUG +  werror("Rethrowing error...\n"); + #endif +  throw (err); +  }    // If we get an rxml error and there's no rxml context then    // we're called from a direct request to the image cache.    // The error ought to have been reported in the page that    // generated the link to the image cache, but since it's too    // late for that now, we just log it as a (brief) server    // error with the referring page.    string errmsg = "Error in " + name + " image generation: " +    err->msg;    if (sizeof (id->referer))    errmsg += " Referrer: " + id->referer[0];
Roxen.git/server/base_server/roxen.pike:4335:    string message) == 1)    {    // File not found.    report_debug("Requesting unknown key %s %O from %O\n",    message,    id->not_query,    (sizeof(id->referer)?id->referer[0]:"unknown page"));    return 0;    }    } + #ifdef ARG_CACHE_DEBUG +  werror("Rethrowing error...\n"); + #endif    throw (err);    }    if( !(res = restore( na,id )) ) { -  error("Draw callback %O did not generate any data.\n" +  report_error("Draw callback %O did not generate any data.\n"    "na: %O\n"    "id: %O\n",    draw_function, na, id); -  +  return 0;    }    }    res->stat = ({ 0, 0, 0, 900000000, 0, 0, 0, 0, 0 });       // Setting the cacheable flag is done in order to get headers sent which    // cause the image to be cached in the client even when using https    // sessions.    RAISE_CACHE(INITIAL_CACHEABLE);       // With the new (5.0 and newer) arg-cache enabled by default we can
Roxen.git/server/base_server/roxen.pike:4553:    // Note: The OPTIMIZE TABLE step has been disabled. /mast    int now = time();    mapping info = localtime(now);    int wait = (int) ((24 - info->hour) + 24 + 4.5) * 3600 + random(500);    background_run(wait, do_cleanup);       // Remove items older than one week    flush(now - 7 * 3600 * 24);    }    -  void create( string id, function draw_func ) +  protected void create( string id, function draw_func )    //! Instantiate an image cache of your own, whose image files will    //! be stored in a table `id' in the cache mysql database,    //!    //! The `draw_func' callback passed will be responsible for    //! (re)generation of the images in the cache. Your draw callback    //! may take any arguments you want, depending on the first argument    //! you give the <ref>store()</ref> method, but its final argument    //! will be the RequestID object.    //!    //! @note
Roxen.git/server/base_server/roxen.pike:4583:    name = id;    draw_function = draw_func;    init_db();    // Support that the 'local' database moves.    master()->resolv( "DBManager.add_dblist_changed_callback" )( init_db );       // Always remove entries that are older than one week.    background_run( 10, do_cleanup );    }    -  void destroy() +  protected void destroy()    {    if (mixed err = catch(sync_meta())) {    report_warning("Failed to sync cached atimes for "+name+"\n");   #if 0   #ifdef DEBUG    master()->handle_error (err);   #endif   #endif    }    }