Giter VIP home page Giter VIP logo

Comments (7)

akram avatar akram commented on July 20, 2024

Hi @spasche ,

can you help us investigate the issue by telling in which case you are falling:
https://github.com/openshift/jenkins-client-plugin/blob/master/src/main/java/com/openshift/jenkins/plugins/pipeline/OcWatch.java#L111

Based on what we have in the code, the return true is captured and normal exit code are also captured

public class ClientCommandRunner implements Serializable {

?

from jenkins-client-plugin.

spasche avatar spasche commented on July 20, 2024

Hi @akram,

According to the logs, this path is taken: https://github.com/openshift/jenkins-client-plugin/blob/master/src/main/java/com/openshift/jenkins/plugins/pipeline/OcWatch.java#L127

Here are the logs with the testcase.

Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] readFile
[Pipeline] _OcWatch
Entering watch
Running watch closure body
[Pipeline] {
[Pipeline] }

watch closure returned true; terminating watch
[Pipeline] // _OcWatch
[Pipeline] echo
List of processes
[Pipeline] sh
+ sleep 10
[Pipeline] sh
+ ps -efw
UID          PID    PPID  C STIME TTY          TIME CMD
1000700+       1       0  0 16:38 ?        00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 99d
1000700+       7       0  0 16:39 pts/0    00:00:00 sh
1000700+      37       0  0 16:39 ?        00:00:00 sh
1000700+      43      37  3 16:39 ?        00:00:00 oc --server=https://kubernetes.default.svc.cluster.local --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=default --loglevel=0 --token=... get configmap/foo -w -o=name
1000700+      70       1  0 16:39 ?        00:00:00 sh -c ({ while [ -d '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7' -a \! -f '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt' ]; do touch '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-log.txt'; sleep 3; done } & jsc=durable-092e8611f10f2111256b1d5babcb2670b22bcb4e427908c6dd8bb8566a9d64c0; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/script.sh' > '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt.tmp'; mv '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt.tmp' '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt'; wait) >&- 2>&- &
1000700+      71      70  0 16:39 ?        00:00:00 sh -c ({ while [ -d '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7' -a \! -f '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt' ]; do touch '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-log.txt'; sleep 3; done } & jsc=durable-092e8611f10f2111256b1d5babcb2670b22bcb4e427908c6dd8bb8566a9d64c0; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/script.sh' > '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt.tmp'; mv '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt.tmp' '/home/jenkins/agent/workspace/testcase@tmp/durable-3dff92c7/jenkins-result.txt'; wait) >&- 2>&- &
1000700+      83      71  0 16:39 ?        00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 3
1000700+      92       1  0 16:39 ?        00:00:00 sh -c ({ while [ -d '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f' -a \! -f '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt' ]; do touch '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-log.txt'; sleep 3; done } & jsc=durable-092e8611f10f2111256b1d5babcb2670b22bcb4e427908c6dd8bb8566a9d64c0; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/script.sh' > '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt.tmp'; mv '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt.tmp' '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt'; wait) >&- 2>&- &
1000700+      93      92  0 16:39 ?        00:00:00 sh -c ({ while [ -d '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f' -a \! -f '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt' ]; do touch '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-log.txt'; sleep 3; done } & jsc=durable-092e8611f10f2111256b1d5babcb2670b22bcb4e427908c6dd8bb8566a9d64c0; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/script.sh' > '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt.tmp'; mv '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt.tmp' '/home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/jenkins-result.txt'; wait) >&- 2>&- &
1000700+      94      92  0 16:39 ?        00:00:00 sh -xe /home/jenkins/agent/workspace/testcase@tmp/durable-bb43849f/script.sh
1000700+      96      94  0 16:39 ?        00:00:00 ps -efw
1000700+      97      93  0 16:39 ?        00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 3
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
Finished: SUCCESS

I can notice that the issue doesn't happen if I run the job directly on the master with this testcase:

  openshift.withCluster() {
    def cm = openshift.create('cm', 'foo')
    cm.watch {
      return true
    }
    echo "List of processes"
    sh "sleep 10"
    sh "ps -efw"
  }

In this case, the process is properly terminated.

So the issue could be related to how the Kubernetes plugin launches processes.

I came across this issue on the Kubernetes plugin, which might be the cause: https://issues.jenkins.io/browse/JENKINS-58656

I tried the suggestion from https://gist.github.com/car-roll/4471dc9231abeb1db1271ad349706bcb (setting pod.spec.shareProcessNamespace to true) but that didn't help.

from jenkins-client-plugin.

akram avatar akram commented on July 20, 2024

@spasche reading the issue you are mentioning , it seems that issue should happen when the agent container does not use an init process in the docker image.
On our side, we are using one for the parent base image of our agents.
You are using inline PodTemplate declaration in your example and seem to be using direct the cli image .

Can you try using instead our agent-base-image and setting the entrypoint agent to the go-init binary that we embed there?
As you said, I think that for this one, we may depend on the kubernetes-plugin.

cc @gabemontero

from jenkins-client-plugin.

openshift-bot avatar openshift-bot commented on July 20, 2024

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

from jenkins-client-plugin.

openshift-bot avatar openshift-bot commented on July 20, 2024

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

from jenkins-client-plugin.

openshift-bot avatar openshift-bot commented on July 20, 2024

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

from jenkins-client-plugin.

openshift-ci avatar openshift-ci commented on July 20, 2024

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

from jenkins-client-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.