Skip to content

Error calling with java a exported function by eta in a multi-thread environment #979

Description

@Boreaso

Description

I want to export a function like this:

foreign export java "@static eta.example.MyClass.sayAnything" sayAnythingEta :: String -> IO ()
sayAnythingEta text = do
putStrLn text
return text

How can I call it in java. Further more, how call I call it in java multi-thread mode.

I try to run it in java multi-thread environment, then I got exceptions:

Exception in thread "pool-1-thread-5" eta.runtime.exception.EtaException: thread blocked indefinitely in an MVar operation
at eta.runtime.stg.Capability.detectMVarDeadlock(Capability.java:703)
at eta.runtime.stg.Capability.idleLoop(Capability.java:690)
at eta.runtime.stg.Capability.blockedLoop(Capability.java:728)
at eta.runtime.stg.Capability.blockedLoop(Capability.java:724)
at eta.runtime.concurrent.Concurrent.takeMVar(Concurrent.java:71)
at base.ghc.io.handle.Internals$$wa2.call(Internals.hs:164)
at base.ghc.io.handle.Internals$a3.applyV(Internals.hs:133)
at eta.runtime.exception.Exception.maskAsyncExceptions(Exception.java:42)
at base.ghc.io.handle.Internals$$wa4.call(Internals.hs:131)
at base.ghc.io.handle.Internals$$wa3.call(Internals.hs:237)
at base.ghc.io.handle.Internals$wantWritableHandle1.call(Internals.hs:227)
at base.ghc.io.handle.Text$hPutStr2.call(Text.hs:544)
at main.Main$$fe_sayHelloEta1.call(Main.hs:10)
at main.Main$$fe_sayHelloEta.call(Main.hs:9)
at main.Main$$fe_sayHelloEta.applyV(Main.hs:9)
at eta.runtime.stg.Closures$EvalIO.enter(Closures.java:177)
at eta.runtime.stg.Capability.schedule(Capability.java:246)
at eta.runtime.stg.Capability.scheduleClosure(Capability.java:202)
at eta.runtime.Runtime.evalIO(Runtime.java:400)
at eta.example.Duckling.sayHello(Unknown Source)
at Main$1.run(Main.java:18)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Please help me!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions