Repository navigation
osm2pgsql crash #2370
Description
Activity
Can you please provide a minimal example pbf (preferably not larger than 1 or 2 MB) that produces the crash.
I use https://slice.openstreetmap.us
Try on https://download.geofabrik.de/europe/liechtenstein.html
Same crashThe file works fine on Linux, so this is a Windows issue for which we can only give limited support, I'm afraid.
Can you please try with the latest build from https://github.com/osm2pgsql-dev/osm2pgsql/actions/runs/16625471270 ? This might be the same issue as #2326, which was fixed in latest master.
If it still crashes, then we'd need a full backtrace of the crash.
Still crashes with latest build. Can you give me simple way to obtain backtrace?
@alexvaler and @lonvia : I am running exactly the same configuration on Windows here, just with my PostgreSQL 17.5 database on a virtual machine with Ubuntu, but osm2pgsql run from under windows. This shouldn't make a difference though.
I see no problems with the latests osm2pgsql build for Windows as downloaded from here and both running osm2pgsql in 'flex' or 'pgsql' mode, both work fine. The flex mode used a custom flex style I developed myself, pgsql mode as per @alexvaler 's setup with just the default style of pgsql mode. Flex mode imported the Geofabrik Denmark extract, pgsql mode Liechtenstein.
By the way @alexvaler : I guess with "16,0 ГБ SSD" you meant to write "16 GB RAM"...
My Windows machine runs with all the latest Windows updates installed.
PGSQL Mode:
FLEX Mode:

@alexvaler : I noticed you didn't specify a PostgreSQL schema on your command line. You are aware that from PG15, access to PostgreSQL's default 'public' schema was restricted, and it is highly recommended to create a custom schema and use that to store the data?
EDIT: Just noticed in the manual it is only relevant for 'flex' output, not 'pgsql' as used by you.
If somebody on Windows can help the OP with creating a stacktrace that would be nice. Otherwise there isn't much I can do.
If somebody on Windows can help the OP with creating a stacktrace that would be nice. Otherwise there isn't much I can do.
I doubt this is an osm2pgsql issue.
I think the OP needs to re-install or update his Microsoft Visual C++ Redistributable, as the failing 'MSVCP140.dll' seems to be part of that:
https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170I have all the below versions installed, including the latest 2015-2022 version. Having more than one version installed is apparently no problem, as I was never prompted to uninstall older versions, but a newer version may be needed for osm2pgsql.

Alternatively, for a stack trace, Microsoft's WinDbg might be an option:
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/- locked and limited conversation to collaborators
on Aug 7, 2025
What version of osm2pgsql are you using?
osm2pgsql version 2.1.1
What operating system and PostgreSQL/PostGIS version are you using?
Windows 10
Database version: 17.5 PostGIS version: 3.5
Tell us something about your system
Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 3.41 GHz
16,0 ГБ SSD
What did you do exactly?
C:\Distr\Postgres\osm2pgsql-bin>osm2pgsql.exe -c -s -d gis --user postgres --port 5439 f31cc82f-32e8-4fe8-a535-eb8da64efc55.osm.pbf
2025-07-31 10:04:15 osm2pgsql version 2.1.1
2025-07-31 10:04:15 Database version: 17.5
2025-07-31 10:04:15 PostGIS version: 3.5
C:\Distr\Postgres\osm2pgsql-bin>
What did you expect to happen?
Load file to database.
What did happen instead?
Имя сбойного приложения: osm2pgsql.exe, версия: 0.0.0.0, метка времени: 0x67fcc054
Имя сбойного модуля: MSVCP140.dll, версия: 14.32.31326.0, метка времени: 0x7255e0ca
Код исключения: 0xc0000005
Смещение ошибки: 0x0000000000013278
Идентификатор сбойного процесса: 0x4d68
Время запуска сбойного приложения: 0x01dc01e978ed3330
Путь сбойного приложения: C:\Distr\Postgres\osm2pgsql-bin\osm2pgsql.exe
Путь сбойного модуля: C:\Windows\SYSTEM32\MSVCP140.dll
Идентификатор отчета: 51ab3739-6665-443a-b84b-efc2bf8845e7
Полное имя сбойного пакета:
Код приложения, связанного со сбойным пакетом:
What did you do to try analyzing the problem?
Test on different files (70 mb - 3gb). Always same crash.