artemp/mapnik — Issue #581: Multithreading error when using generate_tiles.py and PostGIS
Author: artemp
Created: 2011-10-11 16:26:46+00:00
State: open
Labels: PostGIS_Input_Driver

We have encountered problems with using multithreading feature of
generate_tiles.py: when using more than one thread, we get Mapnik exception
"RuntimeError: PSQL error" from the src/plugins/input/postgis/connection.hpp
at line 97 (Mapnik 0.7.1, WinXP SP3):

{{{

84: if(!result || PQresultStatus(result) != PGRES_TUPLES_OK)
85: {
86: std::string s("PSQL error");
87: if (conn_ )
88: {
89: std::string msg = PQerrorMessage( conn_ );
90: if ( ! msg.empty() )
91: {
92: s += ":\n" + msg.substr( 0, msg.size() - 1 );
93: }
94:
95: s += "\nFull sql was: '" + sql + "'\n";
96: }
97: throw mapnik::datasource_exception( s );
98: }

}}}

The SQL syntax of the executing query is OK and is working fine with one thread.
Maybe the code here is somehow not MAPNIK_THREADSAFE aware?