rzo1 opened a new pull request, #266:
URL: https://github.com/apache/openjpa/pull/266

   https://issues.apache.org/jira/browse/OPENJPA-3065
   
   `mvn -T 8 clean install` failed intermittently, for two independent reasons.
   
   ### 1. Enhancer: `ConcurrentModificationException` in `test-enhance`
   
   `XMLPersistenceMetaDataParser` kept its deferred embeddable metadata 
(`_embeddables`, `_embeddableAccess`) in **static** maps. In a parallel build 
the `test-enhance` executions of e.g. `openjpa-xmlstore` and 
`openjpa-integration-daytrader` share the plugin class realm, so their parsers 
wrote to and drained the same unsynchronized `HashMap`/`ArrayList`:
   
   ```
   java.util.ConcurrentModificationException
       at java.util.HashMap.computeIfAbsent
       at o.a.o.persistence.XMLPersistenceMetaDataParser.deferEmbeddable
       at o.a.o.persistence.XMLPersistenceMetaDataParser.startEmbeddedId
       ...
       at o.a.o.enhance.PCEnhancer.<init>
   ```
   
   Besides the CME, one parse could pick up or clear another parse's deferred 
field metadata. The same applies at runtime whenever two persistence units 
parse `orm.xml` concurrently in one JVM.
   
   Fix: the maps are per parser instance. Nested parsing (OPENJPA-1135), where 
the nested parser resolves the enclosing parser's deferrals, keeps working: 
`PersistenceMetaDataFactory.getXMLParser()` hands the nested parser the 
enclosing parser's maps via `shareDeferredEmbeddables()`. Behaviour within one 
repository is unchanged.
   
   ### 2. apache-rat-plugin 0.18 is not thread safe
   
   Under `-T` RAT 0.18 either fails with its own CME 
(`AbstractFileProcessorBuilder.build`) or ignores the configured excludes and 
reports thousands of files under `target/`. 0.18 is the latest release, so the 
plugin is pinned to 0.16.1 and the configuration is translated:
   
   - `counterMax` -> `numUnapprovedLicenses`, `inputExcludes` -> `excludes`
   - `inputIncludes` is dropped: in 0.17+ it only re-includes otherwise 
excluded files, whereas 0.16 `includes` would *restrict* the check to `src/`
   - `dependency-reduced-pom.xml` -> `**/dependency-reduced-pom.xml` (0.16 
patterns are relative to the base dir)
   
   The per-file reports of 0.18 and 0.16.1 match, except for 
`openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/sql/database.sql`, which 
0.18 classified as an unknown type and silently skipped. It got the ASF header 
the other SQL files use; the `sqlActionRefresh` IT still passes.
   
   ### Testing
   
   - Before: 2 of 3 `mvn -T 8 clean install -DskipTests -Drat.skip=true` runs 
failed in `test-enhance`.
   - After: 14 of 14 `-T 8` runs that reached the enhancer passed (6 of them 
with RAT enabled, ~53 s each), no CME.
   - Enhanced output unchanged: identical class/resource contents between `-T 
8` and `-T 1` builds; the `openjpa` jar and all test jars have identical sha256.
   - RAT still fails on a source file without a license header.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to