Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-37566] - FindBugs - Cleanup issues in ExportTable implementation #157

Merged

Conversation

oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev commented Mar 7, 2017

This pull request just suppresses two issues in ExportTable implementation.

  • Caching of stacktrace for heapdumps. No warnings anymore
  • Ignore Serialization warnings for ExportList since this class is a part of internal API && is not being actually serialized

For discussion about caching or Source stacktraces:

  • It is a legacy behavior introduced by @kohsuke in 5db46de (remoting-2.40).
  • For every object Deallocation and Reference Counter Increment Remoting calculates the stacktrace and then also clones it. Implementation in Throwable is provided below
  • The current behavior causes calculation and memory overheads, just to make heapdumps to provide more info
  • I doubt we want this behavior to be enabled by default

Throwable implemetation:

    public StackTraceElement[] getStackTrace() {
        return getOurStackTrace().clone();
    }

    private synchronized StackTraceElement[] getOurStackTrace() {
        // Initialize stack trace field with information from
        // backtrace if this is the first call to this method
        if (stackTrace == UNASSIGNED_STACK ||
            (stackTrace == null && backtrace != null) /* Out of protocol state */) {
            int depth = getStackTraceDepth();
            stackTrace = new StackTraceElement[depth];
            for (int i=0; i < depth; i++)
                stackTrace[i] = getStackTraceElement(i);
        } else if (stackTrace == null) {
            return UNASSIGNED_STACK;
        }
        return stackTrace;
    }

JENKINS-37566

@reviewbybees

@ghost
Copy link

ghost commented Mar 7, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

* @return Cloned version of the inner cache.
*/
@CheckReturnValue(when = When.NEVER)
protected final StackTraceElement[] updateOurStackTraceCache() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just inline again and use @SuppressFBWarnings.

@oleg-nenashev
Copy link
Member Author

@reviewbybees done

@oleg-nenashev oleg-nenashev merged commit 02958b3 into jenkinsci:master Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants