[JIRA] (JENKINS-61216) NPE in git plugin building environment variables for node

13 views
Skip to first unread message

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 29, 2020, 12:00:04 PM2/29/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Jenkins / Bug JENKINS-61216
NPE in git plugin building environment variables for node
Change By: Mark Waite
Summary: NPE in SCM Plugin git plugin building environment variables for node
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 29, 2020, 12:01:02 PM2/29/20
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-61216
 
Re: NPE in git plugin building environment variables for node

Can you provide more insights on the specific circumstances that cause the problem?

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 29, 2020, 12:04:02 PM2/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61216
Can you provide more insights on the specific circumstances that cause the problem?


The stack trace seems to align with git plugin 4.1.1.  Can you confirm that you were running git plugin 4.1.1?

Was there anything distinctive about the master, either in terms of the version of the master, the operating system on which the master was running, or the environment on the master?

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 29, 2020, 12:12:03 PM2/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61216
Can you provide more insights on the specific circumstances that cause the problem?

The stack trace seems to align with git plugin 4.1.1.  Can you confirm that you were running git plugin 4.1.1?

Was there anything distinctive about the master, either in terms of the version of the master, the operating system on which the master was running, or the environment on the master?


I've labeled this as 'newbie-friendly' in hopes that others will investigate based on the stack trace.  In this case, since the [TreeMap javadoc|https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html#putAll-java.util.Map-] says that it will throw a null pointer exception if the argument is null (unlikely) or if the map contains a null key and the map does not permit null keys.  The investigation would be to explore to see what alternatives might cause an agent to have an environment with a null key.  That seems impossible, since a null key in an environment variable would mean that the computer has an environment variable with an empty name.

If exploration does not find a way to duplicate this or if the original submitter does not provide steps that will duplicate the problem, we would close the issue as "Cannot be reproduced".

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Mar 17, 2020, 8:52:04 AM3/17/20
to jenkinsc...@googlegroups.com

"That seems impossible, since a null key in an environment variable would mean that the computer has an environment variable with an empty name."

EnvironmentVariablesNodeProperty sets additional environment variables, could it be possible that the user might be setting an empty env variable for the node?

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 17, 2020, 9:11:02 AM3/17/20
to jenkinsc...@googlegroups.com

Could be, though I think you're describing a null value, rather than a null key. At least, I think I can envision ways that I might assign a null value to a non-null key. I don't know how I would create a null key.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 17, 2020, 9:36:03 AM3/17/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61216
Could be, though I think you're describing a null value, rather than a null key.  At least, I think I can envision ways that I might assign a null value to a non-null key.  I don't know how I would create a null key.


The `buildEnvironment` method in Computer allocates a [new EnvVars|https://github.com/jenkinsci/jenkins/blob/cc3d24c67b62cf6baa37e4e350889ee86c5ccce8/core/src/main/java/hudson/model/Computer.java#L1201], so the EnvVars is not null.  It passes that env to [each nodeProperty|https://github.com/jenkinsci/jenkins/blob/cc3d24c67b62cf6baa37e4e350889ee86c5ccce8/core/src/main/java/hudson/model/Computer.java#L1211] , which then [calls env.putAll|https://github.com/jenkinsci/jenkins/blob/cc3d24c67b62cf6baa37e4e350889ee86c5ccce8/core/src/main/java/hudson/slaves/EnvironmentVariablesNodeProperty.java#L86] to add the agent specific properties to the env that was passed.

The call to `env.putAll()` reports the null pointer exception inside the putAll.  Since the NPE is not reported at buildEnvVars, `env` must not be null.  The putAll NPE seems to indicate that either the [EnvironmentVariablesNodeProperty.envVars|https://github.com/jenkinsci/jenkins/blob/cc3d24c67b62cf6baa37e4e350889ee86c5ccce8/core/src/main/java/hudson/slaves/EnvironmentVariablesNodeProperty.java#L55] is null or it contains a null key.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 17, 2020, 9:44:03 AM3/17/20
to jenkinsc...@googlegroups.com


I've confirmed that I can define an environment variable for an agent and an environment variable for the master which has no name and no value.  When I do that, the system configure and job configure operations both save successfully.  I still don't understand how to duplicate this report.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 20, 2020, 12:11:02 PM3/20/20
to jenkinsc...@googlegroups.com

Harry Papaxenopoulos any further hints you can offer? I can't duplicate the problem.

Reply all
Reply to author
Forward
0 new messages