Skip to content

Running check/apply with buf on Windows fails for files slightly over 4100 bytes #2147

@azam

Description

@azam

Summary

spotlessProtobufCheck/Apply fails with pipe has closed exception, when processing .proto files larger than 4100 bytes, only on Windows.
Reducing the size of the .proto file (remove the last message on attached project) results in successful task execution.

Environment

Spotless: 6.25.0
Buf: 1.31.0
Gradle: 8.7
JVM: Oracle/GraalVM/Temurin 21
OS: OS: Windows 10 Pro Build: 22H2 (19045)
Shell: PowerShell 7.4.2

Stacktrace

English translation for "パイプは終了しました" is "The pipe is being closed".

#### buf: C:\Users\valkyrie\.gradle\caches\modules-2\files-2.1\build.buf\buf\1.31.0\4152371536f12671d4f04b3c2aa14c3182dd1774\buf-1.31.0-windows-x86_64.exe
> Task :spotlessInternalRegisterDependencies UP-TO-DATE

> Task :spotlessProtobuf FAILED
Step 'buf' found problem in 'src\main\proto\service.proto':
パイプは終了しました。
java.io.IOException: パイプは終了しました。
	at com.diffplug.spotless.ProcessRunner.start(ProcessRunner.java:166)
	at com.diffplug.spotless.ProcessRunner.start(ProcessRunner.java:131)
	at com.diffplug.spotless.ProcessRunner.exec(ProcessRunner.java:114)
	at com.diffplug.spotless.ProcessRunner.exec(ProcessRunner.java:109)
	at com.diffplug.spotless.protobuf.BufStep$State.format(BufStep.java:93)
	at com.diffplug.spotless.FormatterFunc$Closeable$3.apply(FormatterFunc.java:125)
	at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:82)
	at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:103)
	at com.diffplug.spotless.Formatter.compute(Formatter.java:246)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:203)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:190)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl.processInputFile(SpotlessTaskImpl.java:105)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl.performAction(SpotlessTaskImpl.java:89)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
	at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:244)

Attached is the full stacktrace for ./gradlew spotlessProtobufCheck --stacktrace.
stacktrace.txt

Reproducible project

Attached is a minimal gradle project that can reproduce the problem. Just run ./gradlew build or ./gradlew spotlessProtobufCheck to reproduce the problem. buf executable is automatically provisioned on the build script for convenience, but running with defaults (using buf executable available on PATH) results with same exception.
spotless-buf-sample.zip


If you are submitting a bug, please include the following:

  • summary of problem
  • Gradle or Maven version
  • spotless version
  • operating system and version
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace

If you're just submitting a feature request or question, no need for the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions