-
Notifications
You must be signed in to change notification settings - Fork 387
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
PhantomJs: ??? in onError + JSCom has been closed #1555
Comments
Thanks for the report. I'll probably not be able to look into it before 26th, though. |
np :) I'll lock in a commit in the reproduction instructions above and switch off phantomjs for now. |
Sweet!! Finally we can reproduce this. |
I can't reproduce this :( It seems this is really just a race somewhere... |
Oh no really? You definately checked it out to aed8b40 (cos I switched to Node JS after that commit). For me it happens 100% of the time. Maybe there's an environmental factor...
|
That might be it... :S |
I've just started getting this in a completely different (private) repo. :( |
This has something to do with object initialisation order I believe. |
Is there anyway we can prioritise this? This issue follows me around from project to project. |
It always mentions
|
This makes me want to swear. A lot. PhantomJS releases are very few and far between... Could we pretty-please have a workaround in SJS for this? Like a configuration setting that determines which |
If you can come up with a work-around in doWriteLine that still uses In any case I'll schedule a least a work-around for 0.6.3. |
I wonder what we could do. Thinking slightly bigger, it might be handy if developers were able to control the behaviour of What do you think about |
You can mutate |
How? |
Ah, right. Well I guess we need to add those. :-s |
Ah, I thought I was missing something again. :) Raised #1598 So the above will facilitate users being able to workaround it themselves (everywhere in source). What should we do to prevent such a need? Maybe redirect |
You can subclass |
Indeed. Actually, I think we should rather solve this particular problem on a JS level (so the Scala code remains as VM agnostic as possibled). Stderr will automatically be redirected to class PhantomJS2Env(
phantomjsPath: String = "phantomjs",
addArgs: Seq[String] = Seq.empty,
addEnv: Map[String, String] = Map.empty,
val autoExit: Boolean = true,
jettyClassLoader: ClassLoader = null
) extends PhantomJSEnv(phantomjsPath, addArgs, addEnv, autoExit, jettyClassLoader) {
override protected def vmName: String = "PhantomJS2"
private val consoleNuker = new MemVirtualJSFile("consoleNuker.js")
.withContent("console.error = undefined;")
override def jsRunner(classpath: CompleteClasspath, code: VirtualJSFile,
logger: Logger, console: JSConsole): JSRunner = {
new PhantomRunner(classpath, code, logger, console) {
override protected def initFiles(): Seq[VirtualJSFile] = super.initFiles :+ consoleNuker
}
}
override def asyncRunner(classpath: CompleteClasspath, code: VirtualJSFile,
logger: Logger, console: JSConsole): AsyncJSRunner = {
new AsyncPhantomRunner(classpath, code, logger, console) {
override protected def initFiles(): Seq[VirtualJSFile] = super.initFiles :+ consoleNuker
}
}
override def comRunner(classpath: CompleteClasspath, code: VirtualJSFile,
logger: Logger, console: JSConsole): ComJSRunner = {
new ComPhantomRunner(classpath, code, logger, console) {
override protected def initFiles(): Seq[VirtualJSFile] = super.initFiles :+ consoleNuker
}
}
} And then use this, instead of the standard PhantomJS: // Set other stuff as you require
postLinkJSEnv := new PhantomJS2Env(jettyClassLoader = scalaJSPhantomJSClassLoader.value) |
That looks like it'd do the job. Is this something you envision being part of Scala.JS? It's quite a large snippet :) Also that's a lot of boilerplate just to add some initial-JS. It might be worthwhile to add an |
I don't know if this should be part of Scala.js. Are you working with PhantomJS 2.0 or with a pre-release version? Maybe we should upgrade to PhantomJS 2.0 anyways internally... @sjrd what do you think? That would also give us proper websockets, meaning we could upgrade to Jetty9. |
Upgrading to PhantomJS 2.0 would be nice, but isn't it a bit too early to drop support for PhantomJS 1.x? |
It's PhantomJS 2.0 final. The issue is marked as a regression so it must be a problem in certain version of PhantomJS 1.x as well. |
Is the error we get from PhantomJS catchable? If yes, we can easily monkey patch
In any case, this will be a testing nightmare for us, since we'll have to test with multiple versions of PhantomJS :( |
What do we want to do about this? It's definitely a crasher in PhantomJS, so it must eventually be fixed. Maybe we could add an overrideable method class PhantomJS2Env(
phantomjsPath: String = "phantomjs",
addArgs: Seq[String] = Seq.empty,
addEnv: Map[String, String] = Map.empty,
val autoExit: Boolean = true,
jettyClassLoader: ClassLoader = null
) extends PhantomJSEnv(phantomjsPath, addArgs, addEnv, autoExit, jettyClassLoader) {
override protected def vmName: String = "PhantomJS2"
private val consoleNuker = new MemVirtualJSFile("consoleNuker.js")
.withContent("console.error = undefined;")
override protected def customInitFiles(): Seq[VirtualJSFile] =
super.customInitFiles() :+ consoleNuker
} @japgolly Would that be acceptable until they fix the issue in PhantomJS? Should we provide |
I don't think we should. In the long run, we should provide proper support for PhantomJS 2.0, with RFC 6455 websockets and Jetty9. So we might will have to envision to create a new separate environment. In the meantime, adding |
This will simplify the user-space workaround for scala-js#1555. It can also be generally useful.
This will simplify the user-space workaround for scala-js#1555. It can also be generally useful.
I would leave this one open. After all it's not solved. We can cross-reference this ticket from the more general PhantomJS 2.0 one. |
OK |
Anything that allows me to workaround this is acceptable to me, but that's my selfish view :) It might be better to have something provided because anyone who uses PhantomJS 2 is going to have this problem, and it could be a very long time before it's fixed upstream. |
Upgrading to Scala.JS 0.6.3 to workaround scala-js/scala-js#1555 seems to fix it.
Using the Even with this fix applied however, this issue still occurs in rare occasions (like when there is an error initialising an object in a test). #1702 will address this. If we apply #1702 and make |
Was hitting some issues (with uncommitted code) with PhantomJS. zenoamaro/react-quill#87 was making React run console.error, which blows up PhantomJS. scala-js/scala-js#1555 ariya/phantomjs#13112 Running tests in Firefox seems more stable, though slower. Unfortunately, I can't run headless firefox on Mac, which is annoying. There is no X11 version of firefox available via brew (Homebrew/legacy-homebrew#9150), or anywhere else apparently (https://trac.macports.org/ticket/42087)
Closing this as wontfix, since we'll be dropping PhantomJS. |
This will simplify the user-space workaround for scala-js/scala-js#1555. It can also be generally useful.
Reproducies:
It's been failing ever since I switched
jsEnv
to phantom js.I get (abbreviated):
When I run
last core-js/test:test
I get:The text was updated successfully, but these errors were encountered: