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

"classpath is corrupted: .scalafmt.conf" in 2.0.0-RC5 and 2.0.0-RC6 #1399

Closed
ArturGajowy opened this issue Apr 8, 2019 · 11 comments
Closed

Comments

@ArturGajowy
Copy link

ArturGajowy commented Apr 8, 2019

I tried to add scalafmtCheckAll to our build after bumping to the latest version, but it results in the following. For some reason, this has only happened once or twice on my machine and from then seems to work.

EDIT: I should probably mention that it happens consistently in our CI, which is blocking me from using scalafmt to guard the PRs...

[info] Set current project to rchain (in build file:/drone/src/github.com/rchain/rchain/)
[error] scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] (rspaceBench / Test / scalafmtCheck) scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] (graphz / Compile / scalafmtCheck) scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] (graphz / Test / scalafmtCheck) scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] (casper / Compile / scalafmtCheck) scalafmt version 2.0.0-RC6 classpath is corrupted: /drone/src/github.com/rchain/rchain/.scalafmt.conf
[error] Total time: 65 s, completed Apr 8, 2019, 10:59:20 AM

To reproduce, you can checkout this PR: https://github.com/rchain/rchain/pull/2331/commits

See also the CI build in question:
https://drone.rchain-dev.tk/rchain/rchain/2683/3

Any ideas what might be wrong? How do I further diagnose that?
Thx!

@non
Copy link

non commented Apr 10, 2019

I'm seeing this as well in CI at work. It seems intermittent in my case, as if some machines get a corrupted cache and some don't.

16:11:32 [info] Checking 1 Scala sources...
16:11:32 [info] Checking 9 Scala sources...
16:11:32 [info] Checking 16 Scala sources...
16:11:32 [error] scalafmt version 2.0.0-RC5 classpath is corrupted: /src/.scalafmt.conf
16:11:32 [error] (core / Test / scalafmtCheck) scalafmt version 2.0.0-RC5 classpath is corrupted: /src/.scalafmt.conf
16:11:32 [error] Total time: 5 s, completed Apr 10, 2019 4:11:32 PM

@olafurpg
Copy link
Member

Thanks for reporting! Hmm, I wonder if this has something to do with how the sbt plugin triggers parallel jobs 🤔 This might be fixed in #1384

@ArturGajowy
Copy link
Author

Thanks for sharing this! :) Based on this, I think I was able to come up with a viable workaround (running this sequentially):

rchain/rchain@bbcf259

https://drone.rchain-dev.tk/rchain/rchain/2856/3

ArturGajowy added a commit to ArturGajowy/rchain that referenced this issue Apr 16, 2019
This will fail the PR build if code isn't formatted properly.
This won't fail builds done by bors, so that it fulfills only
informational role for now. We might decide to enforce that for in bors
builds later, depending on the results.

Parallel execution is disabled for scalafmtCheckAll in CI.
See scalameta/scalafmt#1399 for reasons why.
ArturGajowy added a commit to ArturGajowy/rchain that referenced this issue Apr 16, 2019
This will fail the PR build if code isn't formatted properly.
This won't fail builds done by bors, so that it fulfills only
informational role for now. We might decide to enforce that for in bors
builds later, depending on the results.

Parallel execution is disabled for scalafmtCheckAll in CI.
See scalameta/scalafmt#1399 for reasons why.
ArturGajowy added a commit to ArturGajowy/rchain that referenced this issue Apr 16, 2019
This will fail the PR build if code isn't formatted properly.
This won't fail builds done by bors, so that it fulfills only
informational role for now. We might decide to enforce that for in bors
builds later, depending on the results.

Parallel execution is disabled for scalafmtCheckAll in CI.
See scalameta/scalafmt#1399 for reasons why.
ArturGajowy added a commit to ArturGajowy/rchain that referenced this issue Apr 17, 2019
This will fail the PR build if code isn't formatted properly.
This won't fail builds done by bors, so that it fulfills only
informational role for now. We might decide to enforce that for in bors
builds later, depending on the results.

Parallel execution is disabled for scalafmtCheckAll in CI.
See scalameta/scalafmt#1399 for reasons why.
ArturGajowy added a commit to ArturGajowy/rchain that referenced this issue Apr 17, 2019
This will fail the PR build if code isn't formatted properly.
This won't fail builds done by bors, so that it fulfills only
informational role for now. We might decide to enforce that for in bors
builds later, depending on the results.

Parallel execution is disabled for scalafmtCheckAll in CI.
See scalameta/scalafmt#1399 for reasons why.
@adamw
Copy link

adamw commented Apr 24, 2019

I'm getting this randomly as well, usually when trying to release:

[error] scalafmt version 2.0.0-RC5 classpath is corrupted: /home/jenkins/workspace/Release/tapir-release/.scalafmt.conf
[error] java.lang.NoClassDefFoundError: metaconfig/Configured
[error] 	at java.lang.Class.getDeclaredMethods0(Native Method)
[error] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[error] 	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
[error] 	at java.lang.Class.getMethod0(Class.java:3018)
[error] 	at java.lang.Class.getMethod(Class.java:1784)

@GMadorell
Copy link
Contributor

Yeah, seems like I'm getting the same issue. I have opened another issue in case it's not: #1415

@russwyte
Copy link

Just chiming in that I have seen the same issue on 2.0.0-RC7 and that limiting concurrency to 1 seems to be a workaround for now.

@GMadorell
Copy link
Contributor

I'm limiting concurrency to one in a multiproject and that doesn't fix the problem, at least for our project.

Our project is quite complex though, we have something like 15 different projects managed as a monorepo in a single sbt configuration, all of them using scalafmt for formatting.

eed3si9n added a commit to eed3si9n/zinc that referenced this issue May 13, 2019
@eed3si9n
Copy link
Contributor

Here's what I am doing to reduce the concurrency of scalafmtCheckAll

import sbt._
import Keys._
import org.scalafmt.sbt.ScalafmtPlugin
import ScalafmtPlugin.autoImport._

object FixScalafmtPlugin extends AutoPlugin {
  override def requires = ScalafmtPlugin
  override def trigger = allRequirements

  val ScalaFmtTag = ConcurrentRestrictions.Tag("scalafmt")

  override def globalSettings: Seq[Def.Setting[_]] =
    Seq(
      concurrentRestrictions += Tags.limit(ScalaFmtTag, 1)
    )

  override def projectSettings: Seq[Def.Setting[_]] =
    Seq(
      scalafmtCheckAll := (scalafmtCheckAll.tag(ScalaFmtTag)).value,
      Compile / scalafmtCheck := ((Compile / scalafmtCheck).tag(ScalaFmtTag)).value,
      Test / scalafmtCheck := ((Test / scalafmtCheck).tag(ScalaFmtTag)).value,
    )
}

@tanishiking
Copy link
Member

tanishiking commented Jun 6, 2019

Hi, I released scalafmt-cli 2.0.0-RC8 and sbt-scalafmt 2.0.1 that contains #1384. This release might fix this issue.

@ArturGajowy
Copy link
Author

Hi! I've bumped to the above and they seem to have resolved the issue for me.

https://drone.rchain-dev.tk/rchain/rchain/4254/3
rchain/rchain#2549

I've seen scalafmt run correctly in CI multiple times, including an 8-way parallel run in here:
https://drone.rchain-dev.tk/rchain/rchain/4255/
https://drone.rchain-dev.tk/rchain/rchain/4253

The build failures above in 1 + 2 of the 8 + 8 jobs seems to be a different issue, and with sbt - not sbt-scalafmt plugin or scalafmt itself.

Thank you! :)

@tanishiking
Copy link
Member

@ArturGajowy Thank you for reporting!
Now, let me close this issue :)

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

8 participants