[Tile-serving] mod_tile causes segfault on debian 7.0

Kai Krueger kakrueger at gmail.com
Thu May 23 03:12:17 UTC 2013


On 05/22/2013 01:25 PM, Sven Geggus wrote:
> Kai Krueger <kakrueger at gmail.com> wrote:
>
>> I'll try and fix this tonight and hopefully that will then indeed solve
>> the instability issues Sven and Andy have seen.
With tuning Apache to use many threads per process and set the number of 
requests before Apache reinitialises very low, I was able to reproduce 
the issue fairly easily with apache bench (at a concurrency of 200).

I decided to go for now with the solution of simply wrapping that entire 
code with a mutex, to prevent multiple threads accessing the Apache 
memory routines at the same time.

As it turns out that apr_pool_userdata_get is also not thread-safe (it 
doesn't crash, but can give the wrong results), every request now needs 
to acquire the mutex. However, initial benchmarking indicates that that 
has no measurable effect on performance. Comparing the performance of 
only acquiring the mutex at the process start with acquiring it at every 
request, both achieved about 18.4k tiles per second at a concurrency of 
200 (which was the limit of what the single threaded apache bench could 
handle). However, in the case of not wrapping apr_pool_userdata_get in 
the mutex, I got about 50 failed tiles per 1 million requests (although 
that probably depends on the process restart frequency).

Tom suggested to not use the memory pool user data functions at all and 
instead simply use a static variable. For Apache 2.2 that probably is 
the better solution, as it doesn't require the mutex, but it meant there 
would have been more non shared code between Apache 2.2 and 2.4, which 
is why I went with the current solution for now.

Sven and Andy, could you test this new commit?

If it is confirmed that this solves the issue, then everyone who has 
compiled mod_tile since the 23rd of March 2013 should update their 
mod_tile to prevent this instability.

Thanks for reporting, and thanks Tom for finding the issue so quickly.

Kai

> I changed the server to prefork (for now) and will see if this works.
>
> Sven
>




More information about the Tile-serving mailing list