-
Bug
-
Resolution: Done
-
Major
-
3.0.0.Alpha15
-
None
The javadoc for the copy of AtomicMapFieldUpdater used in core specifies that if putAtomic() returns a value, that the put did not succeed. The transformer and notification registries are full of code checking the return value like https://github.com/kabir/wildfly-core/blob/3396609db1eebf7af382133b7d22fa1828643895/controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java#L270 :
SubRegistry getOrCreate(final String key) { for (;;) { final Map<String, SubRegistry> subRegistries = subRegistriesUpdater.get(this); SubRegistry registry = subRegistries.get(key); if(registry == null) { registry = new SubRegistry(); SubRegistry existing = subRegistriesUpdater.putAtomic(this, key, registry, subRegistries); if(existing == null) { return registry; } else if (existing != registry) { return existing; // Problematic } } return registry; } }
This calling code assumes that if 'existing' is returned and is not the same as the created 'registry' that the put succeeded, and it was added to 'existing'. However, this is not what happens, when 'existing' is returned, its value is actually the same as the 'subRegistries' snapshot, and no insertion has happened.
To clear up the confusion, make AtomicMapFieldUpdater return a boolean where 'true' is returned if the put succeeded, and 'false' when it did not. If 'false' is returned the caller needs to retry the put as implied today.
- blocks
-
JBEAP-4172 Intermittent NPE registering a slave HC in mixed-domain test suite
- Verified
-
WFCORE-1270 Intermittent NPE registering a slave HC in mixed-domain test suite
- Resolved