PhoenicisOrg / phoenicis

Phoenicis PlayOnLinux and PlayOnMac 5 repository
https://phoenicis.org/
GNU Lesser General Public License v3.0
678 stars 73 forks source link

Verb interrupt leads to exception #1816

Open madoar opened 5 years ago

madoar commented 5 years ago

Interrupting the installation of a Verb during the download phase, via a click on the Cancel button, results in an exception:

[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.63) - org.phoenicis.tools.http.DownloadException: Download of https://github.com/Kron4ek/FAudio-Builds/releases/download/19.01/faudio-19.01.tar.xz has failed
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.saveConnectionToStream(Downloader.java:307)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:260)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:237)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:101)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:81)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$170$2701$\^eval\_$cu1$restOf.get([utils, functions, net, download]:124)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$164$1783$\^eval\_$cu1$restOf.get([utils, functions, net, resource]:101)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$137$457A$\^eval\_$cu1$restOf.faudio([engines, wine, verbs, faudio]:18)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$128$1814A$\^eval\_$cu1$restOf.install([engines, wine, verbs, faudio]:65)
    at jdk.nashorn.javaadapters.org_phoenicis_engines_Verb.install(Unknown Source)
    at phoenicis.engines@5.0-SNAPSHOT/org.phoenicis.engines.VerbsManager.lambda$installVerb$0(VerbsManager.java:64)
    at phoenicis.scripts@5.0-SNAPSHOT/org.phoenicis.scripts.nashorn.NashornInteractiveSession.eval(NashornInteractiveSession.java:34)
    at phoenicis.scripts@5.0-SNAPSHOT/org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:43)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.InterruptedException: The download has been aborted
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.saveConnectionToStream(Downloader.java:300)
    ... 15 more

Exception in thread "pool-3-thread-3" org.phoenicis.tools.http.DownloadException: Download of https://github.com/Kron4ek/FAudio-Builds/releases/download/19.01/faudio-19.01.tar.xz has failed
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.saveConnectionToStream(Downloader.java:307)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:260)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:237)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:101)
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.get(Downloader.java:81)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$170$2701$\^eval\_$cu1$restOf.get([utils, functions, net, download]:124)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$164$1783$\^eval\_$cu1$restOf.get([utils, functions, net, resource]:101)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$137$457A$\^eval\_$cu1$restOf.faudio([engines, wine, verbs, faudio]:18)
    at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$128$1814A$\^eval\_$cu1$restOf.install([engines, wine, verbs, faudio]:65)
    at jdk.nashorn.javaadapters.org_phoenicis_engines_Verb.install(Unknown Source)
    at phoenicis.engines@5.0-SNAPSHOT/org.phoenicis.engines.VerbsManager.lambda$installVerb$0(VerbsManager.java:64)
    at phoenicis.scripts@5.0-SNAPSHOT/org.phoenicis.scripts.nashorn.NashornInteractiveSession.eval(NashornInteractiveSession.java:34)
    at phoenicis.scripts@5.0-SNAPSHOT/org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:43)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.InterruptedException: The download has been aborted
    at phoenicis.tools@5.0-SNAPSHOT/org.phoenicis.tools.http.Downloader.saveConnectionToStream(Downloader.java:300)
    ... 15 more
plata commented 5 years ago

Can you check if this is only for verbs? I would assume that you get the same behavior for all downloads. Maybe even if you abort any installation in general.

qparis commented 5 years ago

I think the exception is the way we interrupt a script, isn't it?

plata commented 5 years ago

If it is then it should be caught somewhere.

plata commented 5 years ago

@qparis could you explain how exactly the interrupt works? I see that AbstractStepRepresentation calls messageWaitingForResponse.sendCancelSignal() which uses Message and UiMessageSenderJavaFXImplementation to interrupt the thread. What I do not get is how this should lead to the ScriptException caught in VerbsManager#installVerb. Right now, a PolyglotException is thrown (which is certainly not caught in that try catch block).

Zemogiter commented 4 years ago

On the latest commit I get a slightly different error message than OP.

[ERROR] org.phoenicis.multithreading.ControlledThreadPoolExecutorService (l.64) - java.lang.InterruptedException
    at org.phoenicis.scripts.ui.Message.block(Message.java:35)
    at org.phoenicis.scripts.ui.UiMessageSender.runAndWait(UiMessageSender.java:33)
    at org.phoenicis.scripts.wizard.UiSetupWizardImplementation.presentation(UiSetupWizardImplementation.java:160)
    at <js> go(Unnamed:25:857-947)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke(HostInteropReflect.java:678)
    at com.sun.proxy.$Proxy66.go(Unknown Source)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7(ApplicationInformationPanelSkin.java:237)
    at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval(PhoenicisInteractiveScriptSession.java:35)
    at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1(BackgroundScriptInterpreter.java:45)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by host exception: org.phoenicis.scripts.exceptions.ScriptException: java.lang.InterruptedException

[WARNING] 
org.graalvm.polyglot.PolyglotException: java.lang.InterruptedException
    at org.phoenicis.scripts.ui.Message.block (Message.java:35)
    at org.phoenicis.scripts.ui.UiMessageSender.runAndWait (UiMessageSender.java:33)
    at org.phoenicis.scripts.wizard.UiSetupWizardImplementation.presentation (UiSetupWizardImplementation.java:160)
    at <js>.go (Unnamed:25)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke (HostInteropReflect.java:678)
    at com.sun.proxy.$Proxy66.go (Unknown Source)
    at org.phoenicis.javafx.components.application.skin.ApplicationInformationPanelSkin.lambda$installScript$7 (ApplicationInformationPanelSkin.java:237)
    at org.phoenicis.scripts.session.PhoenicisInteractiveScriptSession.eval (PhoenicisInteractiveScriptSession.java:35)
    at org.phoenicis.scripts.interpreter.BackgroundScriptInterpreter.lambda$createInteractiveSession$1 (BackgroundScriptInterpreter.java:45)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834

Also happens when cancelling an installer.

plata commented 4 years ago

Could be due to updated GraalVM.

madoar commented 4 years ago

I think the question is where should we catch the exception? I agree that interrupting the thread executing the script is a valid decision. The problem is where should we detect this and what is the correct handling of such an exception?

plata commented 4 years ago

I'm not really sure. I would like to get @qparis input regarding this.

Zemogiter commented 4 years ago

@qparis we need your opinion on this

qparis commented 4 years ago

To be honest I do not remember 😊

I’ll investigate this evening