JBehave
  1. JBehave
  2. JBEHAVE-944

Classloader leak as remove is not called on ThreadLocals in StoryRunner

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.7.5
    • Fix Version/s: 3.x
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Windows x64
    • Number of attachments :
      0

      Description

      Overview:

      StoryRunner uses ThreadLocals however does not call remove() on them after use which leads to a classloader leak in our application which uses a long running thread to load and run stories.

        Activity

        In-Hwan Kim made changes -
        Field Original Value New Value
        Summary Classloader leak in StoryRunner as remove is not called on ThreadLocals Classloader leak as remove is not called on ThreadLocals in StoryRunner
        Mauro Talevi made changes -
        Fix Version/s 3.9 [ 19035 ]
        Mauro Talevi made changes -
        Fix Version/s 3.9.1 [ 19830 ]
        Fix Version/s 3.9 [ 19035 ]
        Hide
        Mauro Talevi added a comment -

        Can you please provide more info about this leak. Given the ThreadLocals are set at each run, it's not clear what benefit would bring to remove them at the end of the story run.

        Show
        Mauro Talevi added a comment - Can you please provide more info about this leak. Given the ThreadLocals are set at each run, it's not clear what benefit would bring to remove them at the end of the story run.
        Mauro Talevi made changes -
        Fix Version/s 3.9.1 [ 19830 ]
        Fix Version/s 3.x [ 16979 ]
        Hide
        Stefan Leonhartsberger added a comment -

        We can reproduce this issue as well with 3.9.1.

        Our use case is very simple: We rerun our story a number of times by simply calling:

        Example.java
        for(i=0; i < repetitions; i++) {
              embedder.runStoriesAsPaths(storyPaths);
        }
        

        This ends in a StoryRunner instance per repetition and hence in an OutOfMemory Exception after a lot of repetitions as the reporters which are also retained can keep a lot of recorded data.

        Moreover NOT calling remove() on the ThreadLocals after the story execution has finished isn't a good practice anyway

        Show
        Stefan Leonhartsberger added a comment - We can reproduce this issue as well with 3.9.1. Our use case is very simple: We rerun our story a number of times by simply calling: Example.java for (i=0; i < repetitions; i++) { embedder.runStoriesAsPaths(storyPaths); } This ends in a StoryRunner instance per repetition and hence in an OutOfMemory Exception after a lot of repetitions as the reporters which are also retained can keep a lot of recorded data. Moreover NOT calling remove() on the ThreadLocals after the story execution has finished isn't a good practice anyway

          People

          • Assignee:
            Unassigned
            Reporter:
            In-Hwan Kim
          • Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated: