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

20240610.1.0: still issues related to Visual Studio update with C++ libraries run through Java #10055

Closed
2 of 14 tasks
rouault opened this issue Jun 12, 2024 · 11 comments
Closed
2 of 14 tasks

Comments

@rouault
Copy link

rouault commented Jun 12, 2024

Description

GDAL has been affected by #10004 with the issue with std::mutex and the 20240603 image update. Since 20240610 has been released, I've retried re-enabling GDAL Windows CI testing, and they mostly work, except Java related tests, that run my C++ library through JNI. I suspect the JVM shipped in the image uses a too old VC redist

Cf https://github.com/OSGeo/gdal/actions/runs/9487561784/job/26144477503?pr=10198 for a faulty run

The following tests FAILED:
	  1 - java_GDALOverviews (Failed)
	  2 - java_gdalinfo (Failed)
	  3 - java_ogr2ogr_1 (Failed)
	  4 - java_ogrinfo_1 (Failed)
	  5 - java_ogrinfo_2 (Failed)
	  6 - java_ogr2ogr_2 (Failed)
	  7 - java_ogr2ogr_3 (Failed)
	  8 - java_ogrinfo_3 (Failed)
	  9 - java_OSRTransform (Failed)
	 10 - java_gdalmajorobject (Failed)
	 11 - java_GDALTestIO (Failed)
	 12 - java_GDALTestMultiDim (SEGFAULT)
	 13 - java_GDALContour (Failed)
	 15 - java_ogrtindex (Failed)
	 16 - java_OSRTest (Failed)
 9: #
9: # A fatal error has been detected by the Java Runtime Environment:
9: #
9: #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd926192a0, pid=3372, tid=0x0000000000001464
9: #
9: # JRE version: OpenJDK Runtime Environment (8.0_412-b08) (build 1.8.0_412-b08)
9: # Java VM: OpenJDK 64-Bit Server VM (25.412-b08 mixed mode windows-amd64 compressed oops)
9: # Problematic frame:
9: # C  [msvcp140.dll+0x192a0]
9: #
9: # Core dump written. Default location: D:\a\gdal\gdal\build\swig\java\hs_err_pid3372.mdmp
9: #
9: # An error report file with more information is saved as:
9: # D:\a\gdal\gdal\build\swig\java\hs_err_pid3372.log

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 11
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Runner Image
Image: windows-2022
Version: 20240610.1.0

Is it regression?

Last good build: https://github.com/OSGeo/gdal/actions/runs/9392254916/job/25869181603?pr=10145 (Version: 20240514.3.0)

Expected behavior

should segfault

Actual behavior

segfaults

Repro steps

Build a C++ library using std::mutex with a JNI interface, and run it with the JVM provided in the image

@rouault
Copy link
Author

rouault commented Jun 12, 2024

A workaround I found is to remove msvcp140.dll from "C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk" with OSGeo/gdal@95d092d

@ijunaidm
Copy link
Contributor

@rouault - Thank you for bringing this issue to us. We are looking into this issue, we will update you.

@ijunaidm ijunaidm added awaiting-deployment Code complete; awaiting deployment and/or deployment in progress Area: C/C++ Area: Java and removed Area: Java labels Jun 13, 2024
@shamil-mubarakshin shamil-mubarakshin removed the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Jun 13, 2024
@lelegard
Copy link

Same issue, even after deployment of runner image version 20240610.1.0 which was supposed to fix the issue: #10020 (comment)

@BrianMouncer
Copy link

Even assuming the image get fixed to update all the runtime dlls that are shippen by every application and version of java on the agent, that just means we will build and ship java sdks that will blow up in a similarly spectacular and hard to diagnose way on customers machines who have default unmodified versions of java installed on their machines.

This does not seem like a good compatibility experience for our customers.
Would it be better to revert back to the previous version of visual studio?

@MarkCallow
Copy link

A workaround I found is to remove msvcp140.dll from "C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk" with OSGeo/gdal@95d092d

Since there is no way to ensure all Java users have JVM installations with the latest vcruntime I plan to define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR instead when building our JNI modules and dependencies. Is this define needed with clangcl as well as msvc?

@MarkCallow
Copy link

Is this define needed with clangcl as well as msvc?

I found the answer. Yes it's needed. Longer answer can be found in #10004.

MarkCallow added a commit to KhronosGroup/KTX-Software that referenced this issue Jun 30, 2024
Instead of removing the older version of the vcruntime from the Temurin
JVM installation in the GitHub Actions runner image, define
`_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR` when compiling libktx and
${ASTCENC_LIB_TARGET}. This makes the code compatible with older VC
runtimes removing the burden from users to ensure their JVM installation
uses the latest VC runtime.

See actions/runner-images#10055. For further
background see actions/runner-images#10004 and
https://developercommunity.visualstudio.com/t/Access-violation-in-_Thrd_yield-after-up/10664660#T-N10669129-N10678728.

Includes 2 other minor changes:

1. Move the compiler info dump in `CMakeLists.txt` to before first use
    of the compiler info and recode it to use `cmake_print_variables`.
2. Disable dump of system and platform info in
    `tests/loadtests/CMakeLists.txt`.
@ijunaidm
Copy link
Contributor

ijunaidm commented Jul 7, 2024

@rouault - I hope your issue got resolved, as i can see there was a workaround been used -
by removing msvcp140.dll C++ package from "C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk" with OSGeo/gdal@95d092d
Kindly please update.

@ijunaidm
Copy link
Contributor

ijunaidm commented Jul 9, 2024

@rouault - Closing this issue, thank you for bringing this issue to us. Please feel free to create a new issue if you face any related issues with this windows server 2022 image.

@jackjansen
Copy link

I'm late to the party, but FYI for people getting here in the future: the problem is not limited to Java programs.

I don't use any Java, but because the Java_Temurin-Hotspot_jdk bin directory is earlier in $PATH than the system directories all programs will get their msvcp140.dll from there.

So if you are installing anything on the Windows runner that has been built against MSVC Redist 14.34.31931 or earlier it will fail with this problem.

@Sedeniono
Copy link

Sedeniono commented Aug 4, 2024

@jackjansen One thing that I do not understand in above posts or posts in other related issues that mention $PATH: According to the Microsoft documentation, the directories in $PATH are searched last. Especially the system directories come before. Since the VC redistributable installs the DLLs including msvcp140.dll into the system directories (it does, doesn't it?), shouldn't this mean that all applications should pick up the latest msvcp140.dll, and everything on $PATH effectively gets ignored? Am I missing something?

The only case where I can see problems is if an older msvcp140.dll is located in an application directory (i.e. next to the .exe), because the application directory is searched before the system directories. But this will also cause problems only if that application contains or loads code (plugins, Java/Python modules, etc.) which had been built against the newer Microsoft STL which requires the updated msvcp140.dll.

@jackjansen
Copy link

@Sedeniono I think you may be right. In other words: I now think that I my problem was not caused by the incorrect old msvcp140.dll that I found on $PATH, but in stead by another old version of msvcp140.dll that was loaded into my executable earlier. Sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants