Skip to content

Bash scripts seem to flakily fail #304

Open
@alacoste

Description

@alacoste

Hello!

We recently started using this lib in our jenkins pipelines, and just tried to expand its usage to replace our "sh()" invocations with org.dsty.system.os.shell.Bash.

However we are running in what seems to be random errors (flaky, but frequent enough that it often shows up on at least once in our many sh() calls in a given pipeline).

Our jenkins pipeline code looks like:

def bashResult(String command) {
    def client = new org.dsty.system.os.shell.Bash()
    return client.ignoreErrors(command, /* silent */ true)
}

And the pipeline failure logs look like (extracted only what seem like relevant lines):

[2023-03-14T12:57:30.996Z] sh: /home/jenkins/agent/workspace/platform_deploy_master@tmp/durable-a934192a/script.sh: not found
...
java.nio.file.NoSuchFileException: /home/jenkins/agent/workspace/platform_deploy_master/stdout
	at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(Unknown Source)
	at java.base/java.nio.file.Files.newByteChannel(Unknown Source)
	at java.base/java.nio.file.Files.newByteChannel(Unknown Source)
	at java.base/java.nio.file.Files.readAllBytes(Unknown Source)
	at java.base/java.nio.file.Files.readString(Unknown Source)
	at hudson.FilePath$ReadToString.invoke(FilePath.java:2463)
	at hudson.FilePath$ReadToString.invoke(FilePath.java:2458)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:377)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
	at java.base/java.lang.Thread.run(Unknown Source)

From these logs my hunch for the ~root cause is that the library somehow fails to create some script file it intends to run for the command, but completely unsure!

Here is the blue ocean view:
Screenshot 2023-03-14 at 17 22 59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions