osm2pgsql crashes silently when importing some Geofabrik extracts
I use osm2pgsql to import to PostGis some Geofabrik country extracts. For most of them it worked as expected. For Norway and Tanzania (and England if I remember well) osm2pgsql crashes silently while processing relations.
I tried on 2 different machines with win7 and win8, with extracts from different days months apart, and 2 different versions of osm2pgsql including the latest.
Example command line for Norway:
osm2pgsql.exe --slim --host localhost --port 5432 --username postgres --database norway --prefix osm --cache 1600 --style "
I tried with different sizes of cache and also tried removing the cache option.
The pbf file can be found here (the exact day should not matter): https://download.geofabrik.de/europe/norway-latest.osm.pbf
Style file is the following: #################### STYLE FILE ###################### node,way addr:housenumber text linear node,way addr:interpolation text linear node,way addr:city text linear node,way addr:street text linear node,way addr:postcode text linear node,way addr:country text linear way admin_level text polygon way boundary text polygon way highway text linear node,way name text linear way oneway text linear node,way place text polygon node poi text node,way tunnel text linear node,way waterway text polygon node,way width text linear node,way building text linear node,way source text linear
I tried it on Linux with --cache 1600 and Tanzania, osm2pgsql v0.96.0, it completed in ~ 11 minutes, no signs of silent crashes. What version/build are you using?
Windows 8.* is no longer officially supported by MS, the support for Win7 will end in January 2020. I'd highly recommend to update your system first or use the Linux version before trying anything else.
Also you didn't mention if you're using a 32bit or 64bit version.
I tried it on Linux with
--cache 1600and Tanzania, osm2pgsql v0.96.0, it completed in ~ 11 minutes, no signs of silent crashes. What version/build are you using?
I used the windows binary 64-bit release 0.96.0 https://wiki.openstreetmap.org/wiki/Osm2pgsql#Binary
Windows 8.* is no longer officially supported by MS, the support for Win7 will end in January 2020. > I'd highly recommend to update your system first or use the Linux version before trying anything else.
I can try on a win10 machine but I doubt that it will work. I will try to compile the source code but any help is welcome anyways :)
I used the windows binary 64-bit release 0.96.0
Current release is 1.0.0, see below.
I will try to compile the source code
I think it would make more sense to use the existing unofficial releases for Windows: https://lonvia.dev.openstreetmap.org/osm2pgsql-winbuild/releases/
See https://github.com/openstreetmap/osm2pgsql#installing
Current release is 1.0.0, see below.
Sorry, I realized that I actually tried 1.0.0 too.
Furthermore, I tried with PosgreSQL 9.1 (with postgis 2.0) and 9.6 (with postgis 2.3).
Please make sure that you're only using supported versions. Anything below PostgreSQL 9.4 is no longer supported, see https://www.postgresql.org/support/versioning/
Pg 9.6 is supported but I just tried with the latest Pg 11 with postigis 2.5. Same result: crash while importing relations.
Can you please post some details what exactly you mean by crash? Can you start osm2pgsql from command line and post everything that's printed on the console?
By silent crash I mean that the process stops without errors while still importing the data.
This is the console print out:
C:\osm>"c:\Program Files\osm2pgsql_latest\osm2pgsql.exe" --slim --host 10.12.1.2 5 --port 5432 --username postgres --database tanzania --prefix osm --style "C:\o sm\osm.style" "C:\osm\tanzania-latest.osm.pbf" osm2pgsql version 1.0.0 (64 bit id space)
Allocating memory for sparse node cache Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=9 Mid: pgsql, cache=800 Setting up table: osm_nodes Setting up table: osm_ways Setting up table: osm_rels Using built-in tag processing pipeline Using projection SRS 3857 (Spherical Mercator) Setting up table: osm_point Setting up table: osm_line Setting up table: osm_polygon Setting up table: osm_roads
Reading in file: C:\osm\tanzania-latest.osm.pbf Using PBF parser. Processing: Node(72055k 171.2k/s) Way(11793k 45.89k/s) Relation(12600 1260.00/s) C:\osm>
Please check your PostgreSQL logs for errors. There is a long-standing issue that the connection to the database is closed when using sockets (#159). Another possible cause is that you ran out of memory.
No further info provided by reporter. Closing.