xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
236 stars 78 forks source link

Error 26, Text file busy #34

Closed mhariri closed 6 years ago

mhariri commented 7 years ago

Getting this error sporadically during mvn compile:

build   02-Oct-2017 09:25:10    [ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile-custom (default) on project x-grpc: An error occurred while invoking protoc. Error while executing process. Cannot run program "/apps/bamboo/xml-data/build-dir/x-grpc/target/protoc-plugins/protoc-3.4.0-linux-x86_64.exe": error=26, Text file busy -> [Help 1]

I saw a few references for a similar plugin facing the same issue: https://github.com/os72/protoc-jar/issues/8 and the root cause was a JDK bug, and they worked around it.

More details about the environment:

$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /apps/apache-maven-3.3.9
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_102/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.9-300.fc23.x86_64", arch: "amd64", family: "unix"

Running the maven command from command-line, and plugin configuration is as below:

<plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.0</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:${protobuf-java.version}:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
                    <checkStaleness>true</checkStaleness>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
mhariri commented 7 years ago

This is the workaround they came up with: https://github.com/os72/protoc-jar/commit/b0d2881d0168b496569ac02b4461592fd08e8da9

sergei-ivanov commented 7 years ago

That is an interesting one, certainly not something I've come across before. Let me see if I can port that workaround.

sergei-ivanov commented 7 years ago

Note to self: https://github.com/os72/protoc-jar/commit/b0d2881d0168b496569ac02b4461592fd08e8da9

sergei-ivanov commented 6 years ago

I have committed a similar change that I hope will fix the problem. Unfortunately, I cannot reproduce the problem on my current system, so I cannot tell if it's been fixed. Please give version 0.5.1 a try (I can see it's already been synced to Maven central).