Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LoadModule mapcache_module /usr/lib/apache2/modules/
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel trace8
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<IfModule mapcache_module>
<Directory /data/>
Require all granted
MapCacheAlias /mapcache "/data/mapcache.xml"


docker build -t mapcache-memcached .


Run memcached container (not required to reproduce error)

docker run -it -d --name mymemcached  memcached

Run Mapcache linked to Memcached

docker run -it -d -p 8181:80 --link mymemcached:mymemcached --name mapcache-failing  mapcache-memcached

####Enter container and start Apache2 service

docker exec -it mapcache-failing /bin/bash

Inside container do:

service apache2 start

Tail Apache error log and segmentation fault:

tail -f /var/log/apache2/error.log

Go to your browser and test:


# MapCache container with Memcached support
#This setup reproduces segmentation fault when using memcached in Mapcache as cache backend
FROM ubuntu:14.04
MAINTAINER Martin Bjærge Jensen,
# Set correct environment variables.
ENV HOME /root
ENV TERM=xterm
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
# Install MapCache
RUN apt-get install -y \
apache2 \
wget \
nano \
cmake \
RUN apt-get install -y \
libpng12-dev \
libjpeg62-dev \
libcurl4-gnutls-dev \
apache2-dev \
libpixman-1-dev \
RUN apt-get install -y \
# libgdal-dev \
# libgdal1-dev \
# libgeos-dev \
# libapr1-dev \
# libaprutil1-dev \
libapr-memcache-dev \
#release 1.4.0 causes segmentation fault
RUN wget -O mapcache-1.4.0.tar.gz
RUN tar xf mapcache-1.4.0.tar.gz
RUN cd mapcache-1.4.0 && \
mkdir build &&\
cd build && \
make && \
make install
RUN ldconfig
# Enable site
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf
RUN a2ensite 000-default.conf
RUN chmod 0755 /
# Add VOLUMEs to allow backup of config, logs and databases
VOLUME ["/data"]
ADD mapcache-default.xml /data/mapcache.xml
USER root
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD ["bash", ""]
# OR :
# service apache2 start
<cache name="disk" type="disk">
<cache name="memcache" type="memcache">
<source name="vmap0" type="wms">
<tileset name="test">
<metatile>5 5</metatile>
<service type="wms" enabled="true">
<service type="wmts" enabled="true"/>
<service type="tms" enabled="true"/>
<service type="kml" enabled="true"/>
<service type="gmaps" enabled="true"/>
<service type="ve" enabled="true"/>
<service type="mapguide" enabled="true"/>
<service type="demo" enabled="true"/>
<locker type="disk">
# Start apache
#/usr/sbin/apache2 -D FOREGROUND
tail -f /var/log/apache2/error.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment