mapnik2 and mod_tile

Is there anybody using mapnik2 and mod_tile? I’m asking because I’m getting errors and renderd stops working with exception:

terminate called after throwing an instance of ‘std::runtime_error’
terminate called recursively
what(): dead reference!
Aborted

thanks

mod_tile in combination with mapnik2 works fine. The only thing you need to change is in the Makefile: change -lmapnik to -lmapnik2.

You did remember to rebuild mod_tile after you switched to mapnik2 ?

I did this change in Makefile and rebuild mode_tile after switching to mapnik2. Everything is running and mapnik2 renders files, but for some reason renderd dies with this exception and needs to be restarted manually. I’m trying to understand what happens, but without any result at this moment.

thanks

When rendering tiles with render_list the script stops with a message "recv error: Success
recv error: Success
recv error: Connection reset by peer
"
and in /var/log/syslog there is error “Received error when writing metatile to disk, requesting exit.”
This exception is defined in /mod_tile/gen_tile.cpp

Disk storage for tiles file sytem is ext4 …

it seems like mkdir() is called on the same path at the same time in parallel from renderd …

does anybody knows something about that ?

We get the same crashes with mapnik2 and current mod_tile on a System with Debian Squeeze 6.0. The filesystem for the tiles is XFS.

Here is the debug output of renderd:

renderd[4751]: DEBUG: Got command RenderBulk fd(22) xml(default), z(9), x(32), y(176)
renderd[4751]: DEBUG: Got command RenderBulk fd(20) xml(default), z(9), x(32), y(184)
renderd[4751]: DEBUG: Got command RenderBulk fd(21) xml(default), z(9), x(32), y(192)
renderd[4751]: DEBUG: Got command RenderBulk fd(16) xml(default), z(9), x(32), y(200)
renderd[4751]: DEBUG: Got command RenderBulk fd(17) xml(default), z(9), x(32), y(208)
/var/lib/mod_tile/default/9/0/0/0/37: File exists
renderd[4751]: Received error when writing metatile to disk, requesting exit.
terminate called after throwing an instance of 'std::runtime_error'
  what():  dead reference!

It happens from time to time and it is difficult to reproduce.

Thanks in advance!

Kind Regards,
Thomas Babut

mo_tbabut,

it’s a bug in http://svn.openstreetmap.org/applications/utils/mod_tile/dir_utils.c especially

} else if (mkdir(tmp, 0777)) {

               \\ needs to be checked for error here

                perror(tmp);
                return 1;
            }

I don’t know where to report this bug.

We are testing our own patch for mod_tile:

--- dir_utils.c 2011-04-15 09:57:10.406683976 +0200
+++ dir_utils.c.new     2011-05-17 08:31:41.686953327 +0200
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-
+#include <errno.h>
 
 #include "protocol.h"
 #include "render_config.h"
@@ -45,8 +45,10 @@
                     return 1;
                 }
             } else if (mkdir(tmp, 0777)) {
-                    perror(tmp);
-                    return 1;
+                    if (errno != EEXIST) { // Ignore directory exists error
+                       perror(tmp);
+                        return 1;
+                   }
                 }
             *p = '/';
         }

It runs fine without any crashes since yesterday.

Thomas,

try to remove the directory exists error completely… this is not a problem

I have reported this problem here:
http://trac.openstreetmap.org/ticket/3772

It has been fixed now:
http://trac.openstreetmap.org/ticket/3772