Hi everyone,

I have defined some custom action in my shared library like this (class
whitelisted via -Dhudson.remoting.ClassFilter JAVA_OPTS)

```groovy
@ExportedBean(defaultVisibility = 2)
class CustomAction implements Action, Serializable {
    private String someData

    CustomAction(String someData) {
        this.someData = someData
    }

    // ...
}
```

and library function(to be used then in scripted pipelines)

```groovy
// setCustomAction

@NonCPS
void call(String data) {
    currentBuild.rawBuild.addAction(new CustomAction(data))
}
```

This allows me to expose some specific data which I can read then via build
api.
But unfortunately CustomAction instances added to builds with this function
leads to memory leak and Jenkins crash at the end. I found thousands of
those objects in heapdump, they are never cleaned by GC.

Is this a valid(enough) way to use Action?
Is there some obvious reason(for more skilled Jenkins developers) why this
implementation is bad?
Any idea why those instances are stuck in memory after builds complete and
actions provided by plugins are not?


Regards,
Andrey

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAJ7t4U1tDKF9N6gCPUBFoyqr%3DQC-vtcwAiT4sL-6UQTm2gRy%3Dg%40mail.gmail.com.

Reply via email to