Giter Club home page Giter Club logo

Comments (7)

mPokornyETM avatar mPokornyETM commented on August 14, 2024

can you pls activate this logger and post here the log?

https://github.com/jenkinsci/lockable-resources-plugin/blob/08d4ee9edba86245b35d2a99e57a3b6c9ebcf238/src/main/java/org/jenkins/plugins/lockableresources/queue/QueuedContextStruct.java#L80C2-L80C2

thx

from lockable-resources-plugin.

meeusen avatar meeusen commented on August 14, 2024

We have the same problem. This is all I see (logging ALL of org.jenkins.plugins.lockableresources) after starting jenkins and loading the lockable resource page on Jenkins:

Jan 10, 2024 4:26:04 PM FINE org.jenkins.plugins.lockableresources.BackwardCompatibility compatibilityMigration
lockable-resources-plugin compatibility migration task run for 95 resources
Jan 10, 2024 4:26:04 PM INFO org.jenkins.plugins.lockableresources.NodesMirror createNodeResources
lockable-resources-plugin: configure node resources
Jan 10, 2024 4:26:04 PM FINE org.jenkins.plugins.lockableresources.FreeDeadJobs freePostMortemResources
lockable-resources-plugin free post mortem task run

I can reproduce it like this

  • reserve all resources of a specific label
  • start a pipeline job that tries to lock a resource with that label. This build ends up as a queuedContext in the XML
  • restart Jenkins (https://jenkins/restart)

When Jenkins starts up again, and after opening the lockable resources page, I get the NullPointerException. Also when starting the same job again, it fails with that NullPointerException.

Pipeline: Groovy (workflow-cps) Version 3837.v305192405b_c0
Lockable Resources Version 1222.v3d55a_36d63e4
Jenkins 2.426.2

from lockable-resources-plugin.

mPokornyETM avatar mPokornyETM commented on August 14, 2024

feel free to review changes in the related PR #609

from lockable-resources-plugin.

meeusen avatar meeusen commented on August 14, 2024

I've tried the version of PR #609. Now the pipeline job waits for an available resource, but when I manually unreserve one of those resources, I still get the NullPointerException.

jenkins    | Caused by: java.lang.NullPointerException: Cannot invoke "org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.get()" because "this.executionRef" is null
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getExecution(CpsStepContext.java:217)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:242)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:236)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:293)
jenkins    | 	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
jenkins    | 	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unreserve(LockableResourcesManager.java:961)
jenkins    | 	at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnreserve(LockableResourcesRootAction.java:581)
jenkins    | 	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
jenkins    | 	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
jenkins    | 	... 116 more

When I make the same change at https://github.com/mPokornyETM/lockable-resources-plugin/blob/fix-possible-npe-in-get-queue/src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java#L965 (catch all exceptions), then I can unreserve the resource again. So then there is one resource free, but the pipeline only continues after unreserving another resource, as unreserving the first time only tries to continue with the invalid queuedContext.

from lockable-resources-plugin.

mPokornyETM avatar mPokornyETM commented on August 14, 2024

because "this.executionRef" is null

strange, the exception "because "this.executionRef" is null" happens in other plugin. Not here, I tries just to cacht it. May we chat samewhere else. I need maybe some more configs ... , Because I have really no idea, how can I simulate it.

Or can you try to write test case in this branch, which can simulate the scenario?

from lockable-resources-plugin.

meeusen avatar meeusen commented on August 14, 2024

Unfortunately, I can't reproduce it in a development environment, so I don't know what triggers the problem.

I can force it in a development environment by removing the "executionRef" element from a QueuedContextStruct in the XML. Not sure if this is useful for finding the actual problem though, but it seems to yield the same results in the lockable resources plugin.

    <org.jenkins.plugins.lockableresources.queue.QueuedContextStruct>
      <context class="org.jenkinsci.plugins.workflow.cps.CpsStepContext" plugin="[email protected]">
        <executionRef class="flow-owner" plugin="[email protected]">
          <job>lock-resource-long-time</job>
          <id>60</id>
        </executionRef>
        <id>7</id>
        <bodyHeads/>
        <body class="org.jenkinsci.plugins.workflow.cps.HandleBodyReference">
          <id>5</id>
        </body>
        <threadId>4</threadId>
        <stepDescriptorId>org.jenkins.plugins.lockableresources.LockStep</stepDescriptorId>
      </context>
      <lockableResourcesStruct>
      ...
    </org.jenkins.plugins.lockableresources.queue.QueuedContextStruct>

from lockable-resources-plugin.

mPokornyETM avatar mPokornyETM commented on August 14, 2024

Thats too much hacking. I mean, when the xml file is broken, or other plugin throws unexpected exceptions, it is too hard to handle it here.
Anyway, I thinkg the proposed changes are OK. Because it does not matter, why the item can not be proceeded. It shall be removed from queue.

from lockable-resources-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.