Skip to content
Browse files
[FIX JENKINS-48349] Cache permission id to avoid allocating of new st…

Every request that comes from Jelly is checked against Permissions.
As result it leads to a call of `getId` method that produces the new string.
Usually it's not a problem, but in case of stop-the-world pause user requests are accumulated.
So, once pause is finished, we forcibly allocated tons of strings for
every request. That leads to new stop-the-world pause. (And this cycle
can repeat multiple times)

(cherry picked from commit b2c40cb)
  • Loading branch information
Jimilian authored and olivergondza committed Jan 3, 2018
1 parent 0e5db01 commit 8fa79061bb0beaf93be4e05620463fd363ac5b30
Showing 1 changed file with 8 additions and 1 deletion.
@@ -68,6 +68,9 @@ public int compare(@Nonnull Permission one, @Nonnull Permission two) {

public final @Nonnull PermissionGroup group;

// if some plugin serialized old version of this class using XStream, `id` can be null
private final @CheckForNull String id;

* Human readable ID of the permission.
@@ -158,6 +161,7 @@ public Permission(@Nonnull PermissionGroup group, @Nonnull String name,
this.impliedBy = impliedBy;
this.enabled = enable;
this.scopes = ImmutableSet.copyOf(scopes); = owner.getName() + '.' + name;

@@ -222,7 +226,10 @@ public boolean isContainedBy(@Nonnull PermissionScope s) {
* @see #fromId(String)
public @Nonnull String getId() {
return owner.getName()+'.'+name;
if (id == null) {
return owner.getName() + '.' + name;
return id;

@Override public boolean equals(Object o) {

0 comments on commit 8fa7906

Please sign in to comment.