Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] windows server 2022 - unable to load gdal_wrap #150

Closed
dawsidious opened this issue Aug 27, 2024 · 6 comments
Closed

[BUG] windows server 2022 - unable to load gdal_wrap #150

dawsidious opened this issue Aug 27, 2024 · 6 comments
Assignees
Labels
bug Something isn't working requires:more-information This issue requires more information requires:repro The issue is not currently repro-able

Comments

@dawsidious
Copy link

Hello there :-)

I have an ASP.NET WEB API c# project using gdal which includes :

  • MaxRev.Gdal.Core
  • MaxRev.Gdal.WindowsRuntime.Minimal
  • MaxRev.Gdal.LinuxRuntime.Minimal.x64

I tried both 3.9.1.246 and 3.9.1.247 (both failed).

I publish it through Visual studio with these parameters:

  • configuration : release any cpu
  • target framework : net8.0
  • deployemend mode : self-contained
  • target runtime: win-x64

the project runs fine on :

  • windows 11 (24H2 26120.1542)
  • docker (under ubuntu 24)

output :

\bin\Release\net8.0\publish> dotnet .\test.Host.dll
About OS: Microsoft Windows 10.0.26120
OS Architecture: X64
Runtime Identifier: win-x64
Working directory: *****test.Host\bin\Release\net8.0\publish
Trying to configure all twice
GDAL configured
OGR Vector Drivers: 81
GDAL Raster Drivers: 150
Package version: 3.9.1.247
GDAL Version: 3.9.1
GDAL INFO: GDAL 3.9.1, released 2024/08/14
...
... (all loading)
...
Test string:
"AAIGrid","ACE2","ADRG","AIG","AirSAR","AmigoCloud","AVCBin","AVCE00","BAG","BIGGIF","BLX","BMP","BSB","BT","BYN","CAD","CALS","Carto","CEOS","COASP","COG","COSAR","CPG","CSV","CSW","CTable2","CTG","DAAS","DERIVED","DGN","DIMAP","DIPEx","DOQ1","DOQ2","DTED","DXF","ECRGTOC","EDIGEO","EEDA","EEDAI","EHdr","EIR","ELAS","Elasticsearch","ENVI","ERS","ESAT","ESRI Shapefile","ESRIC","ESRIJSON","FAST","FIT","FITS","FlatGeobuf","GenBin","Geoconcept","GeoJSON","GeoJSONSeq","GeoRSS","GFF","GIF","GML","GMLAS","GNMDatabase","GNMFile","GPKG","GPSBabel","GPX","GRASSASCIIGrid","GRIB","GS7BG","GSAG","GSBG","GSC","GTFS","GTI","GTiff","GTX","GXF","HDF4","HDF4Image","HDF5","HDF5Image","HF2","HFA","HTTP","Idrisi","ILWIS","Interlis 1","Interlis 2","IRIS","ISCE","ISG","ISIS2","ISIS3","JAXAPALSAR","JDEM","JML","JP2OpenJPEG","JPEG","JPEGXL","JSONFG","KML","KMLSUPEROVERLAY","KRO","L1B","LAN","LCP","Leveller","LIBKML","LOSLAS","LVBAG","MAP","MapInfo File","MapML","MBTiles","MEM","Memory","MFF","MFF2","MiraMonVector","MRF","MSGN","MSSQLSpatial","MVT","MySQL","NAS","NDF","netCDF","NGSGEOID","NGW","NITF","NOAA_B","NSIDCbin","NTv2","NWT_GRC","NWT_GRD","OAPIF","ODBC","ODS","OGCAPI","OGR_GMT","OGR_PDS","OGR_SDTS","OGR_VRT","OpenFileGDB","OSM","OZI","PAux","PCIDSK","PCRaster","PDF","PDS","PDS4","PGDUMP","PGeo","PLMOSAIC","PLSCENES","PMTiles","PNG","PNM","PostGISRaster","PostgreSQL","PRF","R","Rasterlite","RIK","RMF","ROI_PAC","RPFTOC","RRASTER","RS2","RST","S102","S104","S111","S57","SAFE","SAGA","SAR_CEOS","SDTS","Selafin","SENTINEL2","SGI","SIGDEM","SNODAS","SQLite","SRP","SRTMHGT","STACIT","STACTA","SVG","SXF","Terragen","TGA","TIGER","TIL","TopoJSON","TSX","UK .NTF","USGSDEM","VDV","VFK","VICAR","VRT","WAsP","WCS","WEBP","WFS","WMS","WMTS","XLS","XLSX","XPM","XYZ","Zarr","ZMap"
Drivers:217

the project crashes on windows server 2022 (21H2 20348.2655 OR 20348.2461).

dotnet .\test.Host.dll
About OS: Microsoft Windows 10.0.20348
OS Architecture: X64
Runtime Identifier: win-x64
Working directory: ******\publish
Trying to configure all twice
Unhandled exception. System.TypeInitializationException: The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception.
---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'gdal_wrap' or one of its dependencies: A dynamic link library (DLL) initialization routine failed. (0x8007045A)
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Gdal(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..ctor()
at OSGeo.GDAL.GdalPINVOKE..cctor()
--- End of inner exception stack trace ---
at OSGeo.GDAL.GdalPINVOKE.AllRegister()
at OSGeo.GDAL.Gdal.AllRegister()
at MaxRev.Gdal.Core.GdalBase.ConfigureGdalDrivers(String gdalDataFolder)
at MaxRev.Gdal.Core.GdalBase.ConfigureAll()
at WebAero.Web.Scheduler.Host.Startup.Program.Main(String[] args) in ****test.Host\Startup\Program.cs:line 31

image

the file gdal_wrap.dll is already in the folder; do you have any idea on what i do wrong ? :)
Thanks a lot for your help !

@dawsidious dawsidious added the bug Something isn't working label Aug 27, 2024
@MaxRev-Dev
Copy link
Owner

I tried to repro this. My build works without any issues.
The environment is plain Windows Server 2022 with Git and Dotnet8 installed.
The self-contained app works as well.

image

@MaxRev-Dev MaxRev-Dev added requires:more-information This issue requires more information requires:repro The issue is not currently repro-able labels Aug 27, 2024
@MaxRev-Dev
Copy link
Owner

MaxRev-Dev commented Aug 27, 2024

Could you please post a MRE if available. Also you can try to run LDD from GitBash.
See this comment for details #143 (comment)

@dawsidious
Copy link
Author

Thanks for info.

I have recreated a Windows Server 2022 eval from scratch, to have the same version as you (cf screenshot).
It is a virtual machine running under proxmox VE 8.

Then i have generated a MRE project as minimal as possible to reproduce the same behavior (it is ok on win 11 but not win 2022).
I Have set the full project (+ publish folder) on my onedrive : https://1drv.ms/f/s!Agg2DlhA4TQqjZRlu-xnv_DtLU1siA?e=lItaIO

for the LDD git bash, i can run it on the project .dll but when i try to use it on gdal.dll or gdal_wrap.dll, it keeps running for few hours without displaying any output. do you know if it is the normal behavior ?

image

Since we use the exact same version of SRV2022 EVAL (without any modification), i think we can skip this issue.
Maybe it is either related to the virtual machine itself, or the project.
But the project with older version of GDAL (offical one) without moving to maxrev.gdal.core was working on the SRV2022 server.

any idea ? :)

@sjoertiej

This comment was marked as off-topic.

@MaxRev-Dev
Copy link
Owner

MaxRev-Dev commented Nov 2, 2024

@dawsidious I took me a while. I have installed VirtualBox and with the same configuration I have a repro.
I suppose it's missing instructions in VM, because if falls down to kernel on profiling via dependency walker while having the identical set of dependencies and same OS configuration (almost).
It can be a missing AVX2 instruction.

It's 100% missing AVX2, I have tested with disabled Hyper-V.

I can't test it currently but recommend you to try disabling Hyper-V and this will enable AVX/AVX2 instructions in your VM.
OR use Hyper-V managed virtual machine.

Edit: I had to disable Core Isolation > Memory Integrity to force turn off Hyper-V.

@MaxRev-Dev
Copy link
Owner

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires:more-information This issue requires more information requires:repro The issue is not currently repro-able
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants