Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3689

NullPointerException coming from Settings / LegacyPropertiesConfigurationProvider (thread-safety issue?)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.14, 2.2.3.1
    • 2.3.15
    • None
    • None
    • Any; multi-core machines tend to demonstrate the problem more readily though.

    • Patch

    Description

      When running a load test, we intermittently see failures with this stack trace (the line numbers are for 2.0.14, but we also see this with 2.2.3.1):

      Exception in thread "MultiThreadTestRunner-5" java.lang.NullPointerException
      	at org.apache.struts2.config.Settings.get(Settings.java:175)
      	at org.apache.struts2.config.Settings.getDefaultInstance(Settings.java:293)
      	at org.apache.struts2.config.Settings.getInstance(Settings.java:109)
      	at org.apache.struts2.config.LegacyPropertiesConfigurationProvider.register(LegacyPropertiesConfigurationProvider.java:67)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
      	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
      	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
      	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
      	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
      	at com.example.platform.test.servlet.OurServlet.handleRequest(OurServlet.java:64)
      

      or

      Caused by: java.lang.NullPointerException
      	at org.apache.struts2.config.LegacyPropertiesConfigurationProvider.loadSettings(LegacyPropertiesConfigurationProvider.java:86)
      	at org.apache.struts2.config.LegacyPropertiesConfigurationProvider.register(LegacyPropertiesConfigurationProvider.java:69)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
      	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
      	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
      	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
      	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
      

      Our suspicion is that the initialisation isn't thread-safe; we've not seen this failure on older, single-processor / single-core machines.

      Attachments

        Issue Links

          Activity

            People

              lukaszlenart Lukasz Lenart
              jabley James Abley
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: