Spring Tool Suite
  1. Spring Tool Suite
  2. STS-2189

Spring Loaded: Trouble loading really big Enums

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.8.0.RELEASE
    • Fix Version/s: None
    • Component/s: SERVER
    • Labels:
      None

      Description

      When I have Spring Loaded running my VM crashes when loading really big Enums.

      I've included a test case.

      • Import this project
      • Enable Spring Loaded
      • Hit the HomeController

      Locally I get the following error:

      INFO : com.test.enums.HomeController - Welcome home! the client locale is en_US
      =============== DEBUG MESSAGE: unimplemented bytecode ================

      #

      1. A fatal error has been detected by the Java Runtime Environment:
        #
      2. EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x023326d0, pid=15176, tid=15116
        #
      3. JRE version: 6.0_25-b06
      4. Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode windows-x86 )
      5. Problematic frame:
      6. j com.test.enums.BigEnum.<clinit>()V+11410
        #
      7. An error report file with more information is saved as:
      8. D:\projects\ide\hs_err_pid15176.log
        #
      9. If you would like to submit a bug report, please visit:
      10. http://java.sun.com/webapps/bugreport/crash.jsp
        #

        Activity

        Hide
        Mike Youngstrom added a comment -

        If I make the enum significantly smaller it works.

        Show
        Mike Youngstrom added a comment - If I make the enum significantly smaller it works.
        Hide
        Andy Clement (c) added a comment -

        this is pretty much what you would imagine it to be. The extra code around making enums reloadable is bloating the static initializer for the enum. There is a 64k limit on method bodies and after modification the clinit here is > 300k There is room to improve the bytecode modification certainly, and it is also possible to 'special case' the first load to do even less modification that later reloads. However, there is a need to support method splitting for large methods, it is just that this is a bigger piece of work than I want to tackle at the moment.

        Show
        Andy Clement (c) added a comment - this is pretty much what you would imagine it to be. The extra code around making enums reloadable is bloating the static initializer for the enum. There is a 64k limit on method bodies and after modification the clinit here is > 300k There is room to improve the bytecode modification certainly, and it is also possible to 'special case' the first load to do even less modification that later reloads. However, there is a need to support method splitting for large methods, it is just that this is a bigger piece of work than I want to tackle at the moment.
        Hide
        Mike Youngstrom added a comment -

        sounds reasonable. Thanks for looking at it.

        Show
        Mike Youngstrom added a comment - sounds reasonable. Thanks for looking at it.
        Hide
        Mike Youngstrom added a comment -

        Just a note. I don't really want to reload this big enum. I just don't want spring loaded to fail when it loads it. I am aware of the option to disable loading of classes so that works for me for now.

        However, if it was easy it might be nice if Spring Loaded could automatically ignore classes it can detect that it cannot load in leu of support for method splitting. If it isn't worth the work now and you'd rather just fix it when you implement method splitting then that's fine too.

        Show
        Mike Youngstrom added a comment - Just a note. I don't really want to reload this big enum. I just don't want spring loaded to fail when it loads it. I am aware of the option to disable loading of classes so that works for me for now. However, if it was easy it might be nice if Spring Loaded could automatically ignore classes it can detect that it cannot load in leu of support for method splitting. If it isn't worth the work now and you'd rather just fix it when you implement method splitting then that's fine too.
        Hide
        Andy Clement (c) added a comment -

        whilst I had the codebase open for the other bug, I did something simple for this one too (not the method splitting). If your enum has more than 1000 values the values will not be made reloadable (which is what blows the limit). Dev builds contain the change:

        http://repo.springsource.org/libs-snapshot-s3-cache/com/springsource/springloaded/springloaded-core/1.1.1.BUILD-SNAPSHOT/springloaded-core-1.1.1.BUILD-20120821.173635-2.jar

        (and that includes the change from yesterday too).

        The other code in the enum should be reloadable (if you have any) but varying the values will likely cause a nasty reflection related error.

        Show
        Andy Clement (c) added a comment - whilst I had the codebase open for the other bug, I did something simple for this one too (not the method splitting). If your enum has more than 1000 values the values will not be made reloadable (which is what blows the limit). Dev builds contain the change: http://repo.springsource.org/libs-snapshot-s3-cache/com/springsource/springloaded/springloaded-core/1.1.1.BUILD-SNAPSHOT/springloaded-core-1.1.1.BUILD-20120821.173635-2.jar (and that includes the change from yesterday too). The other code in the enum should be reloadable (if you have any) but varying the values will likely cause a nasty reflection related error.
        Hide
        Mike Youngstrom added a comment -

        Thanks Andy! You rock!

        Show
        Mike Youngstrom added a comment - Thanks Andy! You rock!
        Hide
        Emil Berglind added a comment -

        Would it be possible to make this threshold of 1000 a configurable parameter? I have an enum with around 850 values in it and it is blowing the size limit. It'd be great if I could pass in a parameter or something to specify what I want the "reloadable" threshold to be.

        I realize that I can just build the springloaded project from source and change the values in there, but figured that this might be useful to have to allow someone to override the default value.

        Show
        Emil Berglind added a comment - Would it be possible to make this threshold of 1000 a configurable parameter? I have an enum with around 850 values in it and it is blowing the size limit. It'd be great if I could pass in a parameter or something to specify what I want the "reloadable" threshold to be. I realize that I can just build the springloaded project from source and change the values in there, but figured that this might be useful to have to allow someone to override the default value.

          People

          • Assignee:
            Andy Clement (c)
            Reporter:
            Mike Youngstrom
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              First Response Date: