[JIRA] (JENKINS-58119) Cant run P4Groovy sync on multiple executors

0 views
Skip to first unread message

kwirth@perforce.com (JIRA)

unread,
Jun 20, 2019, 11:48:03 AM6/20/19
to jenkinsc...@googlegroups.com
Karl Wirth created an issue
 
Jenkins / Improvement JENKINS-58119
Cant run P4Groovy sync on multiple executors
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: p4-plugin
Created: 2019-06-20 15:47
Environment: Jenkins 2.138.1
P4-Plugin 1.10.0
Labels: P4_VERIFY
Priority: Minor Minor
Reporter: Karl Wirth

If you try to run concurrent P4Groovy jobs that need to create a workspace you will see the error:

 

... p4 client -i
p4 client -i

Error in client specification.
Embedded special characters (*, %%, #, @) not allowed in '/var/lib/jenkins/workspace/JOB_NAME@2'.

This is caused by the 'root' field being parsed as if its a view field.

 

 

Reproduction Steps:

(1) Create a pipeline job using the following build script:

 

node ('master'){
        stage('Checkout') {
                  def p4Workspace = 'jenkins-${NODE_NAME}-${JOB_NAME}-$[EXECUTOR}-src'
                  def ws = [$class: 'ManualWorkspaceImpl', name: p4Workspace , spec: [view: '//depot/Data/... //'+p4Workspace+'/...']]
                  def p4 = p4(credential: 'JenkinsCredential', workspace: ws)
                  def response3 = p4.run('sync')
                  echo (response3.toString())
                 sleep 30                
                  
        }
    }

(2) Run build.

(3) Wait 5 seconds

(4) Run build again.

 

The first build will run without error. The second build will fail immediatly due to '@2' being appended to the workspace root path by Jenkins:

Started by user unknown or anonymous
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/P4Groovy@2
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] p4
... p4 client -o jenkins-master-P4Groovy-$[EXECUTOR}-src +... p4 info +... p4 info +... p4 client -o jenkins-master-P4Groovy-$[EXECUTOR}-src +... p4 client -i +P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
Embedded special characters (*, %%, #, @) not allowed in '/var/lib/jenkins/workspace/P4Groovy@2'.

	at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:145)
	at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:96)
	at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:195)
	at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1506)
	at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:516)
	at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:180)
	at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:159)
	at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:101)
	at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:161)
	at org.jenkinsci.plugins.p4.groovy.P4GroovyTask.invoke(P4GroovyTask.java:42)
	at org.jenkinsci.plugins.p4.groovy.P4GroovyTask.invoke(P4GroovyTask.java:19)
	at hudson.FilePath.act(FilePath.java:1077)
	at hudson.FilePath.act(FilePath.java:1060)
	at org.jenkinsci.plugins.p4.groovy.P4Groovy.run(P4Groovy.java:62)
	at sun.reflect.GeneratedMethodAccessor1500.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:155)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor775.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:182)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

 

 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kwirth@perforce.com (JIRA)

unread,
Jun 20, 2019, 11:49:02 AM6/20/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
If you try to run concurrent P4Groovy jobs that need to create a workspace you will see the error:

 

{code:java}
... p4 client -i
p4 client -i

Error in client specification.
Embedded special characters (*, %%, #, @) not allowed in '/var/lib/jenkins/workspace/JOB_NAME@2'.
{code}
This is caused by the 'root' field being parsed as if its a view field.

 

 


*Reproduction Steps:*


(1) Create a pipeline job using the following build script:

 
{code:java}

node ('master'){
        stage('Checkout') {
                  def p4Workspace = 'jenkins-${NODE_NAME}-${JOB_NAME}-$[EXECUTOR}-src'
                  def ws = [$class: 'ManualWorkspaceImpl', name: p4Workspace , spec: [view: '//depot/Data/... //'+p4Workspace+'/...']]
                  def p4 = p4(credential: 'JenkinsCredential', workspace: ws)
                  def response3 = p4.run('sync')
                  echo (response3.toString())
                 sleep 30                
                  
        }
    }
{code}

(2) Run build.

(3) Wait 5 seconds

(4) Run build again.

 

The first build will run without error. The second build will fail immediatly due to '@2' being appended to the workspace root path by Jenkins:
{noformat}
at java.lang.Thread.run(Thread.java:748){noformat}
 

 

 

 

kwirth@perforce.com (JIRA)

unread,
Jun 24, 2019, 7:48:03 AM6/24/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Environment: Jenkins 2.138.1 /2.164.2
P4-Plugin 1.10.0

kwirth@perforce.com (JIRA)

unread,
Jun 24, 2019, 9:44:04 AM6/24/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Priority: Minor Blocker

kwirth@perforce.com (JIRA)

unread,
Jun 24, 2019, 9:45:02 AM6/24/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Issue Type: Improvement Bug

j.f.brown@sbcglobal.net (JIRA)

unread,
Jun 24, 2019, 12:50:02 PM6/24/19
to jenkinsc...@googlegroups.com
Joel Brown commented on Bug JENKINS-58119
 
Re: Cant run P4Groovy sync on multiple executors

Workaround should be to start all nodes running concurrent builds to not use "@":    "-Dhudson.slaves.WorkspaceList=_"

j.f.brown@sbcglobal.net (JIRA)

unread,
Jun 24, 2019, 12:52:02 PM6/24/19
to jenkinsc...@googlegroups.com
Joel Brown edited a comment on Bug JENKINS-58119
Workaround should be to start all nodes running concurrent builds to not use "@":    start jvm with {{"-Dhudson.slaves.WorkspaceList=_"}}

pallen@perforce.com (JIRA)

unread,
Dec 5, 2019, 10:05:03 AM12/5/19
to jenkinsc...@googlegroups.com
Paul Allen updated an issue
 
Change By: Paul Allen
Priority: Blocker Major
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

jenkins.io@matthew-dews.com (JIRA)

unread,
Dec 31, 2019, 10:59:03 AM12/31/19
to jenkinsc...@googlegroups.com
Matthew Dews commented on Bug JENKINS-58119
 
Re: Cant run P4Groovy sync on multiple executors

I ran into a similar issue on Jenkins 2.204.1, P4-Plugin 1.10.7 when calling a python script that uses p4python.
It reported:
Client Root: C:\Program Files (x86)\Jenkins\workspace\MyJob%404 Current Dir: c:\Program Files (x86)\Jenkins\workspace\MyJob@4
 

Relevant snippet from python script:

 

    p4 = P4()

    try:
        p4.connect()
        info = p4.run("info")
        #...
        client_root = info[0]['clientRoot'if 'clientRoot' in info[
            0] else 'unknown'
        client_cwd = info[0]['clientCwd'if 'clientCwd' in info[
            0] else 'unknown'
        #...
        print("Client Root:\t" + client_root)
        print("Current Dir:\t" + client_cwd)

The workaround Joel describes fixed the issue for me. This was preventing us from running multiple jobs at once.

Reply all
Reply to author
Forward
0 new messages