[jboss-jira] [JBoss JIRA] (WFCORE-1049) ConcreteResourceRegistration#registerSubModel is not thread safe

Brian Stansberry (JIRA) issues at jboss.org
Fri Nov 6 07:37:00 EST 2015


    [ https://issues.jboss.org/browse/WFCORE-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13126339#comment-13126339 ] 

Brian Stansberry commented on WFCORE-1049:
------------------------------------------

Making the method synchronized won't help, as the problem isn't concurrent calls to registerSubmodel. It's that registerSubmodel is publishing an incompletely initialized MRR making it visible to other threads before it has its attributes, operations and children registered. When I looked at the failures in the test, they were NPEs due to later code assuming that children would exist.

Unfortunately I can't remember the name of the failing test so I can't find the failures now. :( I'd like to find those as this will need a JBEAP and that will need some evidence as to how this is an actual problem users will see.

The pull request passes now.

BTW I'm not sure why I added the "check for existing and then register", as the registration itself is a putIfAbsent with a failure if that returns non-null. So the checkIfExisting seems redundant. But I don't think that caused the test failures. Not in the ones I looked at at least.

> ConcreteResourceRegistration#registerSubModel is not thread safe
> ----------------------------------------------------------------
>
>                 Key: WFCORE-1049
>                 URL: https://issues.jboss.org/browse/WFCORE-1049
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Domain Management
>            Reporter: Stuart Douglas
>            Assignee: Brian Stansberry
>             Fix For: 3.0.0.Alpha1
>
>
> registerSubModel checks for existing, then registers, however it is invoked by two threads at the same time it is possible they will both see the resource as not existing and both register.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list