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

Failed to deserialize sjsir files on large project on scalajs 1.1.0 #4085

Closed
ngbinh opened this issue Jun 16, 2020 · 2 comments · Fixed by #4097
Closed

Failed to deserialize sjsir files on large project on scalajs 1.1.0 #4085

ngbinh opened this issue Jun 16, 2020 · 2 comments · Fixed by #4097
Assignees
Labels
bug Confirmed bug. Needs to be fixed.
Milestone

Comments

@ngbinh
Copy link

ngbinh commented Jun 16, 2020

I see this error on a very large project at work when upgrading from scala.js 0.6.32 to 1.1.0

[info] Fast optimizing .../target/scala-2.13/scalajs-bundler/main/gondorappclient-fastopt.js
[debug] Linker: 57836 us
[error] java.io.IOException: Failed to deserialize /path-to/target/scala-2.13/classes/com/anduin/stargazer/fundsub/module/common/
FundSubZenDeskWidget$State.sjsir
[error]         at org.scalajs.linker.interface.unstable.IRFileImpl$$anonfun$withPathExceptionContext$1.applyOrElse(IRFileImpl.scala:65)
[error]         at org.scalajs.linker.interface.unstable.IRFileImpl$$anonfun$withPathExceptionContext$1.applyOrElse(IRFileImpl.scala:58)
[error]         at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)
[error]         at scala.util.Failure.recover(Try.scala:234)
[error]         at scala.concurrent.Future.$anonfun$recover$1(Future.scala:395)
[error]         at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
[error]         at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1425)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) 
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
[error] Caused by: java.nio.file.FileSystemException: path-to-dir/FundSubZenDeskWidget$State.sjsir: Too many open files
[error]         at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
[error]         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[error]         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
[error]         at java.base/sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:201)
[error]         at java.base/java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:253)
[error]         at java.base/java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:311)
[error]         at org.scalajs.linker.PathIRFile$PathIRFileImpl.$anonfun$withChannel$1(PathIRFile.scala:84)
[error]         at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
[error]         at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error]         at scala.util.Success.map(Try.scala:213)
[error]         at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
[error]         at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
[error]         at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
[error]         at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error]         at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1425)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) 
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
[error] (gondorAppClient / Compile / fastOptJS) java.io.IOException: Failed to deserialize path-to-dir/FundSubZenDeskWidget$State.sjsir

chat log on gitter:

sjs1

@gzm0 gzm0 added the bug Confirmed bug. Needs to be fixed. label Jun 17, 2020
@gzm0 gzm0 added this to the v1.1.1 milestone Jun 17, 2020
@gzm0
Copy link
Contributor

gzm0 commented Jun 17, 2020

The parts responsible for I/O do not throttle file opening whatsoever. So indeed the linker will try to open as many files as possible as fast as possible. That's probably causing this indeed.

@sjrd
Copy link
Member

sjrd commented Jun 17, 2020

The only workaround I can think of--before we fix this--is to bump the maximum number of open files at the system level. Here is an article about that for Linux: https://linux.101hacks.com/unix/java-too-many-open-files/

@gzm0 gzm0 self-assigned this Jun 17, 2020
gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 26, 2020
@gzm0 gzm0 linked a pull request Jun 26, 2020 that will close this issue
gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 27, 2020
gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 28, 2020
gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 28, 2020
gzm0 added a commit that referenced this issue Jun 28, 2020
Fix #4085: Throttle concurrent file reads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug. Needs to be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants