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

Application crash when io.github.hcoona.concurrent.NamedMutexPosixImpl.waitOne is called #2

Open
domenicosf opened this issue Jan 5, 2021 · 1 comment

Comments

@domenicosf
Copy link

Hi guys.
I am using your library in a application that i am a developer.
In the application We have wrapped class with internal attribute of type NamedMutex (we use the newInstance to create the implementation) and in this wrapped class we create a waitOne method thar call the NamedMutexPosixImpl.waitOne original method:

public boolean waitOne(long timeout, TimeUnit unit) {
        boolean acquired = false;
        try {
            //Where mutex is of type NamedMutex
            acquired = mutex.waitOne(timeout, unit);
        } catch (AbandonedMutexException ame) {
            System.out.println(ame.getMessage());
        } catch (IOException ioe) {
            System.out.println(ioe.getMessage());
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        if (!acquired) {
            close();
            mutex = createMutex(); //Recreate the mutex using NamedMutex.newInstance method
        }
        return acquired;
    }

We use this code to lock file read/write operations. Sometimes the application crash with the repeated method call waitOne. We are using the following os: Red Hat Enterprise Linux 7 (7.2).
The the usage of method waitOne is crashing the aplication ans always generating a thread dump with the following stack:

J 6744  com.sun.jna.Native.invokeInt(Lcom/sun/jna/Function;JI[Ljava/lang/Object;)I (0 bytes) @ 0x00007f4bc210f329 [0x00007f4bc210f2c0+0x69]
j  com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;ZI)Ljava/lang/Object;+211
j  com.sun.jna.Function.invoke(Ljava/lang/reflect/Method;[Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+271
J 6620 C1 com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; (348 bytes) @ 0x00007f4bc1ca8d2c [0x00007f4bc1ca6900+0x242c]
j  io.github.hcoona.concurrent.$Proxy68.sem_timedwait(Lcom/sun/jna/Pointer;Lio/github/hcoona/concurrent/Pthread$TimeSpecByReference;)I+20
j  io.github.hcoona.concurrent.NamedMutexPosixImpl.waitOne(JLjava/util/concurrent/TimeUnit;)Z+74

Do anyone face this issue before?

@hcoona
Copy link
Owner

hcoona commented Oct 11, 2022

Will try to reproduce it on CentOS 7 in Hyper-V or maybe Docker (docker pull centos:centos7.2.1511).

https://vault.centos.org/

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

No branches or pull requests

2 participants