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

Scalac crashes when Compile Server is used (java.io.FileNotFoundException: ./queries.sql (Read-only file system)) #2323

Closed
tschuchortdev opened this issue Nov 24, 2021 · 1 comment · Fixed by #2332 · May be fixed by #2382

Comments

@tschuchortdev
Copy link
Contributor

tschuchortdev commented Nov 24, 2021

Version: (3.11.0)

Expected behavior

Project compiles successfully regardless of which IDE is used.

Actual behavior

In IntelliJ when the Scala Compile Server is used, the project can not be compiled at all. Scalac crashes with the following error:

exception during macro expansion: Fiber failed.
An unchecked error was produced.
java.io.FileNotFoundException: ./queries.sql (Read-only file system)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
	at zio.logging.LogWriter.<init>(LogWriter.scala:14)
	at zio.logging.LogAppender$.$anonfun$file$1(LogAppender.scala:94)
	at zio.internal.FiberContext.evaluateNow(FiberContext.scala:398)
	at zio.internal.FiberContext.$anonfun$fork$17(FiberContext.scala:770)
	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)

Fiber:Id(1637767953492,10) was supposed to continue to:
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZManaged$.makeExit(ZManaged.scala:2066)
  a future continuation at zio.ZManaged.flatMap(ZManaged.scala:329)
  a future continuation at zio.ZManaged.map(ZManaged.scala:475)
  a future continuation at zio.ZManaged.map(ZManaged.scala:475)
  a future continuation at zio.ZManaged.flatMap(ZManaged.scala:330)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2310)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2327)
  a future continuation at zio.ZManaged.foldCauseM(ZManaged.scala:401)
  a future continuation at zio.ZManaged.flatMap(ZManaged.scala:330)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2310)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2327)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)

Fiber:Id(1637767953492,10) execution trace:
  at zio.logging.LogAppender$.file(LogAppender.scala:94)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO.bracket_(ZIO.scala:288)
  at zio.internal.FiberContext.evaluateNow(FiberContext.scala:555)
  at zio.ZManaged$.makeExit(ZManaged.scala:2065)
  at zio.ZIO$AccessPartiallyApplied$.apply(ZIO.scala:4392)
  at zio.ZManaged.flatMap(ZManaged.scala:329)
  at zio.ZManaged$.succeed(ZManaged.scala:2472)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO.bracket_(ZIO.scala:288)
  at zio.internal.FiberContext.evaluateNow(FiberContext.scala:555)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2310)
  at zio.ZManaged$ReleaseMap$.make(ZManaged.scala:1358)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2307)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2307)
  at zio.ZIO$AccessPartiallyApplied$.apply(ZIO.scala:4392)
  at zio.ZIO.flatten(ZIO.scala:680)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO$.bracketExit(ZIO.scala:2398)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZIO$._IdentityFn(ZIO.scala:4233)
  at zio.ZRef$Atomic.modify(ZRef.scala:215)
  at zio.Semaphore.releaseN0(Semaphore.scala:116)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.Semaphore.withPermits(Semaphore.scala:61)
  at zio.ZIO.run(ZIO.scala:1730)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZRefM$UnifiedSyntax$.modify$extension(ZRefM.scala:429)
  at zio.ZRef$Atomic.set(ZRef.scala:221)
  at zio.ZRefM$UnifiedSyntax$.modify(ZRefM.scala:429)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.Promise$.makeAs(Promise.scala:244)
  at zio.Promise$.make(Promise.scala:238)
  at zio.ZIO$.fiberId(ZIO.scala:2854)
  at zio.ZIO$.descriptor(ZIO.scala:2632)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2302)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2283)
  at zio.ZRef$Atomic.get(ZRef.scala:203)
  at zio.Semaphore.withPermits(Semaphore.scala:61)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.Semaphore.withPermits(Semaphore.scala:61)
  at zio.ZRef$Atomic.modify(ZRef.scala:215)
  at zio.Semaphore.prepare(Semaphore.scala:84)
  at zio.Promise$.makeAs(Promise.scala:244)
  at zio.Promise$.make(Promise.scala:238)
  at zio.ZIO$.fiberId(ZIO.scala:2854)
  at zio.ZIO$.descriptor(ZIO.scala:2632)
  at zio.ZManaged.flatMap(ZManaged.scala:329)
  at zio.ZManaged$.succeed(ZManaged.scala:2472)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO.bracket_(ZIO.scala:288)
  at zio.internal.FiberContext.evaluateNow(FiberContext.scala:555)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2310)
  at zio.ZManaged$ReleaseMap$.make(ZManaged.scala:1358)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2307)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2307)
  at zio.ZIO$AccessPartiallyApplied$.apply(ZIO.scala:4392)
  at zio.ZIO.flatten(ZIO.scala:680)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO$.bracketExit(ZIO.scala:2398)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZIO$._IdentityFn(ZIO.scala:4233)
  at zio.ZRef$Atomic.modify(ZRef.scala:215)
  at zio.Semaphore.releaseN0(Semaphore.scala:116)
  at zio.ZIO$._IdentityFn(ZIO.scala:4233)
  at zio.ZRef$Atomic.modify(ZRef.scala:215)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.Semaphore.withPermits(Semaphore.scala:61)
  at zio.ZIO.run(ZIO.scala:1730)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZRefM$UnifiedSyntax$.modify$extension(ZRefM.scala:429)
  at zio.ZRef$Atomic.set(ZRef.scala:221)
  at zio.ZRefM$UnifiedSyntax$.modify(ZRefM.scala:429)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2303)
  at zio.Promise$.makeAs(Promise.scala:244)
  at zio.Promise$.make(Promise.scala:238)
  at zio.ZIO$.fiberId(ZIO.scala:2854)
  at zio.ZIO$.descriptor(ZIO.scala:2632)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2302)
  at zio.ZRef$.make(ZRef.scala:756)
  at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2283)
  at zio.ZRef$Atomic.get(ZRef.scala:203)
  at zio.Semaphore.withPermits(Semaphore.scala:61)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)

Fiber:Id(1637767953492,10) was spawned by:

Fiber:Id(1637767952980,0) was supposed to continue to:
  a future continuation at zio.ZManaged.mapM(ZManaged.scala:507)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZManaged.flatMap(ZManaged.scala:330)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
  a future continuation at zio.ZIO.run(ZIO.scala:1730)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2310)
  a future continuation at zio.ZLayer$MemoMap$$anon$1.getOrElseMemoize(ZLayer.scala:2327)
  a future continuation at zio.ZManaged.flatMap(ZManaged.scala:329)

Fiber:Id(1637767952980,0) execution trace:
  at zio.ZIO.zipWithPar(ZIO.scala:2287)
  at zio.ZManaged.zipWithPar(ZManaged.scala:1178)
  at zio.ZIO.$amp$amp$amp(ZIO.scala:74)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:160)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:153)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO$.bracketExit(ZIO.scala:2398)
  at zio.internal.FiberContext.evaluateNow(FiberContext.scala:559)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
  at zio.ZIO.bracket_(ZIO.scala:288)

Fiber:Id(1637767952980,0) was spawned by: <empty trace>
    stream(

Workaround

Go to Settings -> Build/Execution/Deployment -> Compiler -> Scala Compiler -> Scala Compile Server and check the checkbox for "Start process in project directory".

@getquill/maintainers
@tdrozdowski

Quill can hardly change this setting for the user, so the file should probably be written to a known directory and not the Scalac working directory.

Related issues: #1715, #2292

@deusaquilus
Copy link
Collaborator

I'm going to disable the file-writing infra by default in the next release. Then will revisit.

Btw the location of the queries.sql file can be changed with -Dquill.log.file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants