Open tomsfernandez opened 2 years ago
Thanks for reporting @tomsfernandez. The issue is that scoverage tries to call .toInt
on this and 2849015114
is too large for an Int
. I'm surprised the number went this high. Is this a large code base you're working with? I'll go ahead and transfer this over to the main scoverage repo as the issue will actually need to be fixed there.
Hi @ckipp01 sorry for taking so long to answer I never saw the notification. I really dont know if our codebase is considered big. The repository in question is www.github.com/aml-org/amf.
I checked our latest CI runs and it appears this happens only sometimes (flaky) 😢 so I guess it will be difficult to replicate or at least to fix the "root" issue.
I encountered the same issue when trying to build a coverage pipeline for my team. I managed to run UT, generated UT report, build a binary for regression coverage, collect regression coverage result and generate RT report. But we trying to merge UT and RT result, we encountered this problem.
[2023-02-13T08:50:39.656Z] [info] Waiting for measurement data to sync... [2023-02-13T08:50:41.019Z] [info] Reading scoverage instrumentation [/ads-forecast/common/src/forecast/spark_planner/target/scala-2.12/scoverage-data/scoverage.coverage.xml] [2023-02-13T08:50:41.580Z] [info] Reading scoverage measurements... [2023-02-13T08:50:41.580Z] [error] java.lang.NumberFormatException: For input string: "1326 " [2023-02-13T08:50:41.580Z] [error] at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) [2023-02-13T08:50:41.580Z] [error] at java.lang.Integer.parseInt(Integer.java:580) [2023-02-13T08:50:41.580Z] [error] at java.lang.Integer.parseInt(Integer.java:615) [2023-02-13T08:50:41.580Z] [error] at scala.collection.immutable.StringLike.toInt(StringLike.scala:304) [2023-02-13T08:50:41.580Z] [error] at scala.collection.immutable.StringLike.toInt$(StringLike.scala:304) [2023-02-13T08:50:41.580Z] [error] at scala.collection.immutable.StringOps.toInt(StringOps.scala:33) [2023-02-13T08:50:41.580Z] [error] at scoverage.IOUtils$.$anonfun$invoked$2(IOUtils.scala:77) [2023-02-13T08:50:41.580Z] [error] at scala.collection.Iterator.foreach(Iterator.scala:941) [2023-02-13T08:50:41.580Z] [error] at scala.collection.Iterator.foreach$(Iterator.scala:941) [2023-02-13T08:50:41.580Z] [error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1429) [2023-02-13T08:50:41.580Z] [error] at scoverage.IOUtils$.$anonfun$invoked$1(IOUtils.scala:75) [2023-02-13T08:50:41.580Z] [error] at scoverage.IOUtils$.$anonfun$invoked$1$adapted(IOUtils.scala:73) [2023-02-13T08:50:41.580Z] [error] at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36) [2023-02-13T08:50:41.580Z] [error] at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33) [2023-02-13T08:50:41.580Z] [error] at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38) [2023-02-13T08:50:41.580Z] [error] at scoverage.IOUtils$.invoked(IOUtils.scala:73) [2023-02-13T08:50:41.580Z] [error] at scoverage.ScoverageSbtPlugin$.loadCoverage(ScoverageSbtPlugin.scala:236) [2023-02-13T08:50:41.580Z] [error] at scoverage.ScoverageSbtPlugin$.$anonfun$coverageReport0$1(ScoverageSbtPlugin.scala:112) [2023-02-13T08:50:41.580Z] [error] at scoverage.ScoverageSbtPlugin$.$anonfun$coverageReport0$1$adapted(ScoverageSbtPlugin.scala:105) [2023-02-13T08:50:41.580Z] [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [2023-02-13T08:50:41.580Z] [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [2023-02-13T08:50:41.580Z] [error] at sbt.std.Transform$$anon$4.work(Transform.scala:67) [2023-02-13T08:50:41.580Z] [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281) [2023-02-13T08:50:41.580Z] [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19) [2023-02-13T08:50:41.580Z] [error] at sbt.Execute.work(Execute.scala:290) [2023-02-13T08:50:41.580Z] [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281) [2023-02-13T08:50:41.580Z] [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178) [2023-02-13T08:50:41.580Z] [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37) [2023-02-13T08:50:41.580Z] [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [2023-02-13T08:50:41.580Z] [error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [2023-02-13T08:50:41.580Z] [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [2023-02-13T08:50:41.580Z] [error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [2023-02-13T08:50:41.580Z] [error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [2023-02-13T08:50:41.580Z] [error] at java.lang.Thread.run(Thread.java:748) [2023-02-13T08:50:41.580Z] [error] (coverageReport) java.lang.NumberFormatException: For input string: "1326 " [2023-02-13T08:50:41.580Z] [error] Total time: 2 s, completed Feb 13, 2023 8:50:41 AM [2023-02-13T08:50:41.580Z] ls: cannot access target/scala-2.12/scoverage-report/*: No such file or directory
Hey @jdbxwyx, thanks for the report. Do you have a reproduction that you could point to or provide?
Hey @jdbxwyx, thanks for the report. Do you have a reproduction that you could point to or provide?
I have to check if the policy of our company allows it.
I cannot show you the measurements and XML files due to company policy. Will it help if I should you the sbt commands we used? FYI: https://github.com/scoverage/scalac-scoverage-plugin/issues/19
sed -i '$a\addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6")' project/plugins.sbt
sed -i '$a\addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6")' project/assembly.sbt
sed -i '$a\coverageEnabled := true' build.sbt
sed -i '$a\coverageExcludedPackages := "xxxxxxx"' build.sbt
sed -i '$a\scoverage-plugins: https://repo1.maven.org/maven2/' /root/.sbt/repositories
sed -i '$a\sbt-buildinfo-plugins: https://scala.jfrog.io/artifactory/sbt-plugin-releases/ , [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]' /root/.sbt/repositories
export SBT_OPTS="-Xms1024M -Xmx4G -Xss2M -XX:MaxMetaspaceSize=2G -Dfile.encoding=utf-8" echo "##### Start to build repo #######" cd "xxx/spark_repo" sbt publishLocal echo "##### Start to build consumer #########" cd "xxx/spark_ack_ratio_consumer" sbt publishLocal echo "##### Start to build application ########" cd "xxx/${component}/" sbt 'set test in assembly := {}' 'set coverageDataDir := file("xxx/regression/coverage/")' clean coverage assembly -mem 2048
export SBT_OPTS="-Xms1024M -Xmx4G -Xss2M -XX:MaxMetaspaceSize=2G -Dfile.encoding=utf-8"
echo "##### Start to build repo #######"
cd "xxx/spark_repo"
sbt publishLocal
echo "##### Start to build consumer #########"
cd "xxx/spark_ack_ratio_consumer"
sbt publishLocal
echo "########start to build UT #######################"
cd "xxx/${component}"
sbt clean
sbt coverage test coverageAggregate -mem 2048 > fail.txt 2>&1
#upload UT code to arti
#upload UT coverage data
echo "##### Start to build repo #######"
cd "xxx/spark_repo"
sbt publishLocal
echo "##### Start to build consumer #########"
cd "xxx/spark_ack_ratio_consumer"
sbt publishLocal
#Get RT coverage data(measurements generated in regression and uploaded to arti) and code
wget_coverage_data
wget_coverage_code
cp xxx/scoverage-data/scoverage.coverage.xml xxx/scoverage-data/
sbt coverageReport -mem 2048
#upload UT coverage data
export SBT_OPTS="-Xms1024M -Xmx4G -Xss2M -XX:MaxMetaspaceSize=2G -Dfile.encoding=utf-8"
echo "##### Start to build repo #######"
cd "xxx/spark_repo"
sbt publishLocal
echo "##### Start to build consumer #########"
cd "xxx/spark_ack_ratio_consumer"
sbt publishLocal
#Get RT coverage data(measurements generated in regression and uploaded to arti) and code
echo "########sync coverage from regression ############"
wget_coverage_data
sbt coverageReport -mem 2048
By the way, I got something like this if I ls in our job. I don't know why the name pattern and different, will it cause the bug?
[2023-02-13T08:50:27.219Z] scoverage.coverage.xml
[2023-02-13T08:50:27.219Z] scoverage.measurements.1265
[2023-02-13T08:50:27.219Z] scoverage.measurements.1266
[2023-02-13T08:50:27.219Z] scoverage.measurements.1267
[2023-02-13T08:50:27.219Z] scoverage.measurements.1268
[2023-02-13T08:50:27.219Z] scoverage.measurements.1270
[2023-02-13T08:50:27.219Z] scoverage.measurements.1271
[2023-02-13T08:50:27.219Z] scoverage.measurements.45783b50-ed20-4825-bccf-a54f63435424.285
[2023-02-13T08:50:27.219Z] scoverage.measurements.45783b50-ed20-4825-bccf-a54f63435424.286
[2023-02-13T08:50:27.219Z] scoverage.measurements.45783b50-ed20-4825-bccf-a54f63435424.287
[2023-02-13T08:50:27.219Z] scoverage.measurements.45783b50-ed20-4825-bccf-a54f63435424.288
[2023-02-13T08:50:27.219Z] scoverage.measurements.783
[2023-02-13T08:50:27.219Z] scoverage.measurements.841
[2023-02-13T08:50:27.219Z] scoverage.measurements.889
[2023-02-13T08:50:27.219Z] scoverage.measurements.895
[2023-02-13T08:50:27.219Z] scoverage.measurements.896
[2023-02-13T08:50:27.219Z] scoverage.measurements.898
[2023-02-13T08:50:27.219Z] scoverage.measurements.899
We're seeing a similar error occasionally/randomly on coverageAggregate
, where it seems to try to cast a partial path String to Int:
+ sbt coverageAggregate
[info] welcome to sbt 1.9.9 (Eclipse Adoptium Java 17.0.11)
[info] loading settings for project flowcommerce_label_pr-2139-build from plugins.sbt ...
[info] loading project definition from /home/jenkins/workspace/flowcommerce_label_PR-2139/project
[info] loading settings for project flowcommerce_label_pr-2139 from build.sbt ...
[info] set current project to label (in build file:/home/jenkins/workspace/flowcommerce_label_PR-2139/)
[info] Aggregating coverage from subprojects...
[info] Found 5 subproject scoverage data directories [target/scala-2.13/scoverage-data,target/scala-2.13/scoverage-data,/home/jenkins/workspace/flowcommerce_label_PR-2139/target/scala-2.13/scoverage-data,target/scala-2.13/scoverage-data,target/scala-2.13/scoverage-data]
[error] java.lang.NumberFormatException: For input string: "arget/scala-2.13/routes/main/label/Routes.scala"
[error] at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[error] at java.base/java.lang.Integer.parseInt(Integer.java:654)
[error] at java.base/java.lang.Integer.parseInt(Integer.java:786)
[error] at scala.collection.immutable.StringLike.toInt(StringLike.scala:310)
[error] at scala.collection.immutable.StringLike.toInt$(StringLike.scala:310)
[error] at scala.collection.immutable.StringOps.toInt(StringOps.scala:33)
[error] at scoverage.serialize.Serializer$.toStatement$1(Serializer.scala:130)
[error] at scoverage.serialize.Serializer$.deserialize(Serializer.scala:179)
[error] at scoverage.serialize.Serializer$.deserialize(Serializer.scala:117)
[error] at scoverage.reporter.CoverageAggregator$.$anonfun$aggregatedCoverage$1(CoverageAggregator.scala:35)
[error] at scoverage.reporter.CoverageAggregator$.$anonfun$aggregatedCoverage$1$adapted(CoverageAggregator.scala:31)
[error] at scala.collection.immutable.List.foreach(List.scala:431)
[error] at scoverage.reporter.CoverageAggregator$.aggregatedCoverage(CoverageAggregator.scala:31)
[error] at scoverage.reporter.CoverageAggregator$.aggregate(CoverageAggregator.scala:22)
[error] at scoverage.ScoverageSbtPlugin$.$anonfun$coverageAggregate0$3(ScoverageSbtPlugin.scala:257)
[error] at scoverage.ScoverageSbtPlugin$.$anonfun$coverageAggregate0$3$adapted(ScoverageSbtPlugin.scala:247)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] at sbt.Execute.work(Execute.scala:292)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] at java.base/java.lang.Thread.run(Thread.java:840)
[error] (coverageAggregate) java.lang.NumberFormatException: For input string: "arget/scala-2.13/routes/main/label/Routes.scala"
[error] Total time: 1 s, completed May 7, 2024, 4:14:04 PM
Hi! I'm getting the following error when using either coverageReport or coverageAggregated. The error doesn't happen 100% of the time I don't know why. Can you help me out please?