question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incremental compiler crashes because of open file handles

See original GitHub issue

I searched StackOverflow and GitHub and found no issues like this, so here we go:

steps

I am running SBT 1.0.1.

I am developing a fairly small Akka HTTP service (which should have nothing to do with the issue but for context). My workflow is to have an SBT shell open and ~compile continuously running.

Today this happened:

[error] Total time: 1 s, completed 5-Sep-2017 3:23:30 PM
[error] java.io.IOException: User limit of inotify instances reached or too many open files
[error]         at sun.nio.fs.LinuxWatchService.<init>(LinuxWatchService.java:64)
[error]         at sun.nio.fs.LinuxFileSystem.newWatchService(LinuxFileSystem.java:47)
[error]         at sbt.Defaults$.$anonfun$globalSbtCore$20(Defaults.scala:250)
[error]         at sbt.Defaults$$anon$3.watchService(Defaults.scala:561)
[error]         at sbt.Watched$.executeContinuously(Watched.scala:92)
[error]         at sbt.BasicCommands$.$anonfun$continuous$2(BasicCommands.scala:215)
[error]         at sbt.CommandUtil$.withAttribute(CommandUtil.scala:42)
[error]         at sbt.BasicCommands$.$anonfun$continuous$1(BasicCommands.scala:213)
[error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error]         at sbt.State$$anon$1.runCmd$1(State.scala:228)
[error]         at sbt.State$$anon$1.process(State.scala:234)
[error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.MainLoop$.next(MainLoop.scala:105)
[error]         at sbt.MainLoop$.run(MainLoop.scala:98)
[error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error]         at sbt.io.Using.apply(Using.scala:22)
[error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error]         at sbt.StandardMain$.runManaged(Main.scala:104)
[error]         at sbt.xMain.run(Main.scala:71)
[error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]         at xsbt.boot.Launch$.run(Launch.scala:109)
[error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]         at xsbt.boot.Boot$.main(Boot.scala:17)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] java.io.IOException: User limit of inotify instances reached or too many open files
[error] Use 'last' for the full log.

Now, unfortunately I derped up and just restarted my sbt and ~compile without pulling the full log…

My max allowed number of file handles is 512k.

λ sysctl fs.inotify.max_user_watches
fs.inotify.max_user_watches = 524288

The number of files in my repo is far smaller than that (44 of these files are non-target/)

λ find . -type f | wc -l
168

problem

Clearly, SBT should not die like this 😃

expectation

That ~compile just keeps going

notes

sbt version: 1.0.1

Point me in a direction and I will try to provide more information. And if this happens again, I will pull the full log as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Duhemmcommented, Sep 6, 2017

Thanks for the report @NeQuissimus. That’s surprising, I’ve tested it on fairly large codebases, akka/akka, scala/scala and apache/spark, without hitting that issue.

In the meantime, I thing you can workaround the issue with:

> set watchService := (() => new sbt.io.PollingWatchService(pollInterval.value))
1reaction
eed3si9ncommented, Sep 30, 2019

Closing this for now since sbt 1.3.x has reimplemented watch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: out of file descriptors for accept() - Cisco Community
CentOS 7. NSO 4.5.5.1. I am seeing the following when trying to perform a check-sync or sync-from on several hundred devices, which causes...
Read more >
Unity Incremental C# Compiler - deprecated
We are deprecating the incremental compiler package. We recommend using the 18.3 builtin C# compiler instead. * Asmdef files are supported ...
Read more >
1911581 – Core dump when hitting file descriptor limit
Booting log: Trying to load: from: /pci@800000020000000/scsi@4/disk@100000000000000 ... qemu-kvm: virtio_bus_set_host_notifier: unable to init event notifier: ...
Read more >
What happens to open files which are not properly closed?
Yes, if there are too many open (not closed) files, there is the too many open files error . But what happens to...
Read more >
Diagnosing Native Crashes | Android Open Source Project
Here the direct cause of the crash is that pthread_mutex_lock(3) has tried ... Android's fdsan file descriptor sanitizer helps catch common ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found