On 2013-06-12 14:16, Alex Bligh wrote:

But that aside, is it safe to call apwrite() from one thread whilst there's a 
read in the other?

I do not know for sure, but I suppose it is not safe if both the read and the write operate on the same brigade.

I'm not calling ap_pass_brigade (at least not directly). I'm doing (roughly)

   ap_filter_t *of = state->r->connection->output_filters;
   ap_fwrite(of, state->obb, (const char *)header, pos); /* Header */

IE I'm doing an fwrite to output filter list, using the bucket brigade I've 
just created. Is that OK?

I've checked the code of ap_fwrite. Apparently it buffers the data in the brigade. If the brigade is full, it calls ap_filter_flush, which, in turn, calls the ap_pass_brigade and clears the brigade after ap_pass_brigade has returned.

So not every call to ap_fwrite will push the data down the filter chain.

Now I think I understand what happens with ap_fwrite (if that calls 
ap_pass_brigade), I'm wondering whether (say) the input filter of mod_ssl ever 
talks to its output filter.

I think it's impossible. The brigade is created by you in the spawned thread, so I don't see how the SSL decode in the main thread could access it. And it's the output brigade that is corrupted, not some brigade internal to mod_ssl. As I see it, the output brigade (state->obb) is not shared between the threads.

Do you get the same errors when you disable mod_ssl?

S




Reply via email to