Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

JNA 5.13.0: C++ Side Mutex Creation Fails with "Invalid Memory" Error

オープン
#1,670 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
cpp, java
領域
tooling

調査の方向性

まず、提供されている createMutex の例を使って、MSVC でビルドされた C++ ライブラリへの Java JNA 呼び出しを再現し、その後、Java/native 境界と、無効なメモリアクセスが報告される mutex の構築またはロックの箇所を調査します。無効なメモリアクセスの原因を特定し、Windows 10 で修正された相互作用を確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description:

When using JNA 5.13.0 to interface with a C++ library, an issue arises where attempting to create a mutex on the C++ side results in an "invalid memory" error. This issue occurs consistently whenever the mutex creation is attempted. Below are the details of the environment and the problem:

Environment:

  • Java Version: 1.8.0_361 (Oracle JDK)
  • JNA Version: 5.13.0(5.17.0 same err)
  • Operating System: [Windows 10]
  • C++ Compiler/Environment: [MSVC]

Problem Description:
The Java application uses JNA to interact with a native C++ library.
On the C++ side, when attempting to create a std::mutex (or any other type of mutex), the program throws an error related to invalid memory access.
The error message or behavior indicates that the memory allocation or usage for the mutex is corrupted or invalid.

Example Code:

Java Side:

public interface MyLibrary extends Library {
    MyLibrary INSTANCE = Native.load("mylibrary", MyLibrary.class);

    void createMutex();
}

public class Main {
    public static void main(String[] args) {
        MyLibrary.INSTANCE.createMutex();
    }
}

C++ Side:

#include <mutex>
extern "C" {
    void createMutex() {
        std::mutex mtx; // Attempting to create a mutex
        mtx.lock();      // Error occurs here or during construction
        mtx.unlock();
    }
}

Error
java.lang.Error: Invalid memory access

主要言語
Java
スター
8.9k
フォーク
1.7k
平均マージ
1日 13時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

java-native-access/jna のほかの issue

java-native-access/jna の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。