Branch: Tag:

2015-05-04

2015-05-04 12:20:02 by Martin Karlgren <marty@roxen.com>

Fix race condition related to http_pipe_in_progress requests.

Destructed RequestID:s were sometimes indexed if the asynchronous thread
called id->send_result() before the main request thread returned from
find_file().

2269:    PROF_LEAVE(Roxen.get_owning_module(tmp[1])->module_name,"location");    if(fid)    { +  if (id)    id->virtfile = loc;       if(mappingp(fid))
2524:    res = low_get_file(id, no_magic);    TIMER_END(get_file);    +  // Note: id may be destructed at this point already (when the +  // request is handled asynchronously, +  // i.e. Roxen.http_pipe_in_progress() is returned, but +  // id->send_result() finishes in another thread before the calling +  // thread gets to this point.) +  if (id && (!mappingp (res) || !res->pipe)) {    // finally map all filter type modules.    // Filter modules are like TYPE_LAST modules, but they get called    // for _all_ files.
2543:    PROF_LEAVE(Roxen.get_owning_module(tmp)->module_name,"filter");    }    TIMER_END(filter_modules); +  }    -  +  if (root_id)    root_id->misc->_request_depth--; -  +  +  if (id)    id->misc->internal_get = orig_internal_get; -  +     return res;   }