Branch: Tag:

2016-09-14

2016-09-14 11:14:11 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Core: Load demand-loaded modules from handler threads.

Avoid loading all modules for a delayed_load configuration
from the backend thread.

NB: Changes API for find_configuration_for_url(); it may now return
a configuration that has not yet been loaded.

Fixes most of [bug 7782 (#7782)].

3346:    "raw_url" : raw_url,    ]));    +  if (!conf->inited) { +  // Load the configuration from a handler thread, and then resume. +  roxen.handle(lambda(Configuration conf) { +  REQUEST_WERR(sprintf("HTTP: Loading configuration %O...", +  conf)); +  conf->enable_all_modules(); +  call_out(got_configuration, 0, conf); +  }, conf); +  return; +  } +  got_configuration(conf); +  }) +  { +  report_error("Internal server error: " + describe_backtrace(err)); +  disconnect(); +  } + } +  + protected void got_configuration(Configuration conf) + { +  if (mixed err = catch { +  REQUEST_WERR(sprintf("HTTP: Got configuration %O", conf)); +     // The "http_request_init" provider hook allows modules to do    // things very early in the request path, before the request is    // put in the handler queue and before the protocol cache is