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

Test case crash with unknow problem. #49

Closed
djx314 opened this issue Sep 30, 2022 · 11 comments
Closed

Test case crash with unknow problem. #49

djx314 opened this issue Sep 30, 2022 · 11 comments

Comments

@djx314
Copy link

djx314 commented Sep 30, 2022

Environment:

  1. Windows/Linux(wsl2)
  2. sbt for jvm
  3. scala.js for scala env
  4. 2.11 - 2.13 for scala version
  5. command: t (alias for +mainProjects/test) or a simple test command: adt-coreJS/test

This project build failed for PhantomJSEnv with unknown reason. Have a test in win and wsl2. The error code will be different in Windows and wsl2.

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

wsl2

[info] Fast optimizing /mnt/e/pro/workspace/simple-nat/modules/main/simple-adt/core/js/target/scala-2.13/simple-adt-core-test-fastopt
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
[error] stack trace is suppressed; run last adt-coreJS / Test / loadedTestFrameworks for the full output
[error] (adt-coreJS / Test / loadedTestFrameworks) org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error] Total time: 94 s (01:34), completed Sep 30, 2022, 10:26:45 AM


sbt:simple-nat> last adt-coreJS / Test / loadedTestFrameworks
[debug] PhantomJS WS Jetty: INFO: jetty-8.1.16.v20140903 WrappedArray()
[debug] PhantomJS WS Jetty: INFO: Started {} WrappedArray(SelectChannelConnector@localhost:34907)
[debug] PhantomJS using webpage launcher at: /tmp/phantomjs-launcher-webpage17731834358584063541.html
[debug] PhantomJS using launcher at: /tmp/phantomjs-launcher16382325301618177454.js
[debug] Starting process: phantomjs /tmp/phantomjs-launcher16382325301618177454.js
[error] org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error]         at org.scalajs.testing.common.RPCCore.helpClose(RPCCore.scala:223)
[error]         at org.scalajs.testing.common.RPCCore.close(RPCCore.scala:215)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.close(JSEnvRPC.scala:69)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1(JSEnvRPC.scala:60)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1$adapted(JSEnvRPC.scala:60)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[error] Caused by: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1(JSEnvRPC.scala:60)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1$adapted(JSEnvRPC.scala:60)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[error] Caused by: org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 134
[error]         at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:200)
[error] (adt-coreJS / Test / loadedTestFrameworks) org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
sbt:simple-nat> 

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

windows cmd

[warn] one warning found
[info] Fast optimizing E:\pro\workspace\simple-nat\modules\main\simple-adt\core\js\target\scala-2.13\simple-adt-core-test-fastopt
[error] stack trace is suppressed; run last adt-coreJS / Test / loadedTestFrameworks for the full output
[error] (adt-coreJS / Test / loadedTestFrameworks) org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error] Total time: 36 s, completed 2022??0?涓婂崍10:34:34
sbt:simple-nat> 
sbt:simple-nat> 
sbt:simple-nat> 
sbt:simple-nat> 
sbt:simple-nat> 
sbt:simple-nat> 
sbt:simple-nat> last adt-coreJS / Test / loadedTestFrameworks
[debug] PhantomJS WS Jetty: INFO: jetty-8.1.16.v20140903 WrappedArray()
[debug] PhantomJS WS Jetty: INFO: Started {} WrappedArray(SelectChannelConnector@localhost:61650)
[error] org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error]         at org.scalajs.testing.common.RPCCore.helpClose(RPCCore.scala:223)
[error]         at org.scalajs.testing.common.RPCCore.call(RPCCore.scala:164)
[error]         at org.scalajs.testing.adapter.TestAdapter.loadFrameworks(TestAdapter.scala:57)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSTestSettings$6(ScalaJSPluginInternal.scala:704)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.enhanceNotInstalledException(ScalaJSPluginInternal.scala:104)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSTestSettings$4(ScalaJSPluginInternal.scala:704)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:834)
[error] Caused by: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1(JSEnvRPC.scala:60)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1$adapted(JSEnvRPC.scala:60)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
[error] Caused by: java.nio.file.FileSystemException: E:\pro\workspace\simple-nat\modules\main\simple-adt\core\js\target\scala-2.13\simple-adt-core-test-fastopt: Unable to determine if root directory exists
[error]         at java.base/java.nio.file.Files.createDirectories(Files.java:771)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.$anonfun$writeWebpageLauncher$1(PhantomJSEnv.scala:219)
[error]         at scala.collection.immutable.List.flatMap(List.scala:366)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.writeWebpageLauncher(PhantomJSEnv.scala:209)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.createTmpWebpage(PhantomJSEnv.scala:189)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.createTmpLauncherFile(PhantomJSEnv.scala:126)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.internalStart(PhantomJSEnv.scala:58)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.$anonfun$startWithCom$1(PhantomJSEnv.scala:41)
[error]         at org.scalajs.jsenv.phantomjs.ComRun.org$scalajs$jsenv$phantomjs$ComRun$$onServerRunning(ComRun.scala:73)
[error]         at org.scalajs.jsenv.phantomjs.ComRun$$anon$1.onRunning(ComRun.scala:51)
[error]         at org.scalajs.jsenv.phantomjs.JettyWebsocketManager$$anon$2.lifeCycleStarted(JettyWebsocketManager.scala:49)
[error]         at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:174)
[error]         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:65)
[error]         at org.scalajs.jsenv.phantomjs.JettyWebsocketManager.start(JettyWebsocketManager.scala:121)
[error]         at org.scalajs.jsenv.phantomjs.ComRun.<init>(ComRun.scala:66)
[error]         at org.scalajs.jsenv.phantomjs.ComRun$.start(ComRun.scala:267)
[error]         at org.scalajs.jsenv.phantomjs.PhantomJSEnv.startWithCom(PhantomJSEnv.scala:40)
[error]         at org.scalajs.testing.adapter.JSEnvRPC.<init>(JSEnvRPC.scala:46)
[error]         at org.scalajs.testing.adapter.TestAdapter.startManagedRunner(TestAdapter.scala:128)
[error]         at org.scalajs.testing.adapter.TestAdapter.$anonfun$getRunnerForThread$1(TestAdapter.scala:120)
[error]         at scala.collection.concurrent.TrieMap.getOrElseUpdate(TrieMap.scala:895)
[error]         at org.scalajs.testing.adapter.TestAdapter.getRunnerForThread(TestAdapter.scala:120)
[error]         at org.scalajs.testing.adapter.TestAdapter.loadFrameworks(TestAdapter.scala:56)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSTestSettings$6(ScalaJSPluginInternal.scala:704)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.enhanceNotInstalledException(ScalaJSPluginInternal.scala:104)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSTestSettings$4(ScalaJSPluginInternal.scala:704)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:834)
[error] (adt-coreJS / Test / loadedTestFrameworks) org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
sbt:simple-nat> 

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

Can not solve it by git clone project.git in a new directory.

@sjrd
Copy link
Member

sjrd commented Sep 30, 2022

We do not maintain this project anymore. PhantomJS itself has been EOL for years. Keep using it at your own risk.

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

We do not maintain this project anymore. PhantomJS itself has been EOL for years. Keep using it at your own risk.

Oh, I see. @sjrd Then I can understand why this happens. By the way, are there any js environments that can run only depending on the jvm? E.g. nashorn. Just not depending environment out of the sbt and import jar can finish all the test case is ok.

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

What I need is, now I used to shared the project with my friend. Copy the environment is not so friendly for my friend because of the limited code learning.
So I need that just install the jdk and git clone, when I shared I will add the sbt-launcher.jar and sbt.bat

// sbt.bat
java -jar "./sbt-launcher.jar"

in Windows run cmd & sbt, in Linux run ./sbt.bat that all of the develop environment is enough. He can run the test case with jvm & scala.js with the command t. No need to consider with Win/Linux, nor install Node of the right version.
If there is no way to support this requirement, I think use the J2V8 or Javet to make the node.js support just depedent to import a jar is also very good.

// J2V8 & Javet link
https://github.com/eclipsesource/J2V8
https://github.com/caoccao/Javet
https://github.com/caoccao/Javet/releases?q=j2v8&expanded=true

@gzm0
Copy link
Contributor

gzm0 commented Sep 30, 2022

By the way, are there any js environments that can run only depending on the jvm?

I don't think there currently is one implemented. Early versions of Scala.js relied on Rhino (a Nashorn predecessor). However, Rhino struggled with the size of the code Scala.js generated and installing Node.js seemed to be not an issue for most users. So that's the default now.

It is very well possible that nowadays, Nashorn will deal just fine with the Scala.js generated code (it's much smaller now, I'd also expect Nashorn to be better). However, I don't know of any JSEnv implementation for that. (if you want to give it a shot, I'm happy to give you pointers).

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

I don't know of any JSEnv implementation for that.

@gzm0 The J2V8 and Javet is a good choice for the full jvm environment. But J2V8 need to build it yourself. Javet can just import by maven. In the early days, J2V8 is almost the only solution.
These two solutions is the most reliable solution for running js code on the jvm. Because it's not the js env for java. It just build the node and use java jni to run the node itself. So just provide a directory that all the depts is installed by node(finished before sbt plugin release and just copy file to a directory from classpath), then set the node root path to J2V8 and Javet, It will run and just return the result to jvm by jni. But scala-js env no need to get the return value. So it's just simply call the boot script and there is nothing to do.

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

If implement a JSEnv for scala-js's test case is not so hard that can complete by writing a util class. I think I can have a try and share some opinions on use.

@djx314
Copy link
Author

djx314 commented Sep 30, 2022

Update
Javet seems to be the only option now for lastest Node support.
Source discuss

@djx314 djx314 closed this as completed Oct 2, 2022
@djx314
Copy link
Author

djx314 commented Oct 2, 2022

Use node current and close.

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

3 participants