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

Program doesn't shut down properly in some cases on windows #159

Open
lhns opened this issue Jul 21, 2022 · 0 comments
Open

Program doesn't shut down properly in some cases on windows #159

lhns opened this issue Jul 21, 2022 · 0 comments

Comments

@lhns
Copy link

lhns commented Jul 21, 2022

I have noticed that in some cases the program doesn't shut down properly on windows when using an effect framework like cats-effect for scala.
I made a simple java program to demonstrate the weird behaviour.
When I try to stop the programm normally (SIGINT) it just hangs. The main thread is not stopped and no shutdown hooks are run. This doesn't happen when I don't mount a filesystem or unmount it before shutting down. It seems to be related to the exit signals since System.exit does not cause this behaviour.
I have not tried another platform besides windows.
Maybe there is some kind of signal handler in winsfp that kills the java threads or something similar.
I have not yet found any workaround.

import ru.serce.jnrfuse.FuseStubFS;

import java.nio.file.Paths;

public class StopTest {
    public static void main(String[] args) {
        Runtime.getRuntime().addShutdownHook(
                new Thread(() -> System.out.println("SHUTDOWN"))
        );

        new FuseStubFS().mount(Paths.get("J:\\"), false);

        while (true) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
@lhns lhns changed the title Program doesn Program doesn't shut down properly in some cases Jul 21, 2022
@lhns lhns changed the title Program doesn't shut down properly in some cases Program doesn't shut down properly in some cases on windows Jul 21, 2022
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

1 participant