Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5644

Lost configProperties due to concurrent adds to not thread safe hashmap

XMLWordPrintable

    • Hide

      *) Define a lot of connection definitions in a resource adapter (I used 1000 connection definition)

      *) Put the logger for 'org.jboss.as.connector.deployers' at TRACE level

      *) Start the server

      *) Search in the server.log for strings starting with "Activating:"

      *) You'll see that some connection-definitions are missing one or more config properties

      Show
      *) Define a lot of connection definitions in a resource adapter (I used 1000 connection definition) *) Put the logger for 'org.jboss.as.connector.deployers' at TRACE level *) Start the server *) Search in the server.log for strings starting with "Activating:" *) You'll see that some connection-definitions are missing one or more config properties

      Having a lot of resource adapters configurations, I noticed that sometimes e connection definition/admin object missed one o more config properties (this also led to a further worse problem caused by another bug that I'm also going to report)

      I reproduced it and the problem is caused by the configProperties HashMap in org.jboss.as.connector.subsystems.resourceadapters.Modifiable

      {AdminObject|ConnDef}

      .java that is accessed by multiple model operations at the same time.

      I fixed it transforming the HashMap in a ConcurrentHashMap.
      I also noticed that in the past a similar fix was made in ModifiableResourceAdapter where the add* method where made synchronized (probably because the HashMaps are inherited by the classes in IronJacamar).
      Maybe instead of the ConcurrentHashMap a synchronized addConfigProperty (and maybe getConfigProperties) can be used instead.

      My doubt is that I don't known if a ConcurrentHashMap/synchronized methods are enough or also the reads need to be synchronized. From what I see looks like the other method getConfigProperties is called after all the configProperties are added.

      I'm going to attach a pull request with a possible patch that uses a ConcurrentHashMap.

      Thanks!

            simone.gotti_jira Simone Gotti (Inactive)
            simone.gotti_jira Simone Gotti (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: