[
https://issues.apache.org/jira/browse/BEAM-6705?focusedWorklogId=203680&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-203680
]
ASF GitHub Bot logged work on BEAM-6705:
----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Feb/19 14:09
Start Date: 25/Feb/19 14:09
Worklog Time Spent: 10m
Work Description: mwalenia commented on pull request #7939: [BEAM-6705]
Fixes ConcurrentModificationException in RowCoderGenerator
URL: https://github.com/apache/beam/pull/7939
After running ValidatesRunner test suite for Direct Runner using Java 11 I
ran into a ConcurrentModificationException in `RowCoderGenerator.generate`
method.
The cause of the exception was a race condition in a pipeline in
`ParDoSchemaTest.testReadAndWrite`,
`ParDoSchemaTest.testReadAndWriteMultiOutput` and
`ParDoSchemaTest.testReadAndWriteWithSchemaRegistry`, where
`RowCoderGenerator.generate` (and, as a result, `HashMap.computeIfAbsent`) was
called with the same arguments from different threads. This resulted in tests
failing with the exception.
Due to the fact that `HashMap.computeIfAbsent` now throws this exception if
an external change is detected, it seems that the simplest solution is to
change the map class to `ConcurrentHashMap`, which safeguards against such
problems.
@reuvenlax, WDYT?
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [x] [**Choose
reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and
mention them in a comment (`R: @username`).
- [x] Format the pull request title like `[BEAM-XXX] Fixes bug in
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA
issue, if applicable. This will automatically link the pull request to the
issue.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
Post-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
--- | --- | --- | --- | --- | --- | --- | ---
Go | [](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/)
| --- | --- | --- | --- | --- | ---
Java | [](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)
Python | [](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Python3_Verify/lastCompletedBuild/)
| --- | [](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)
<br> [](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/)
| --- | --- | ---
See
[.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md)
for trigger phrase, status and link of all Jenkins jobs.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 203680)
Time Spent: 10m
Remaining Estimate: 0h
> ConcurrentModificationException in ParDoSchemaTest
> --------------------------------------------------
>
> Key: BEAM-6705
> URL: https://issues.apache.org/jira/browse/BEAM-6705
> Project: Beam
> Issue Type: Sub-task
> Components: runner-direct
> Reporter: Michal Walenia
> Assignee: Michal Walenia
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When ran with Java 11, ParDoSchemaTest.testReadAndWriteMultiOutput,
> testReadAndWrite and testReadAndWriteWithSchemaRegistry
> produce ConcurrentModificationExceptions.
> This is due to change in HashMap.computeIfAbsent method specification:
> {quote}Throws:{{[ConcurrentModificationException|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ConcurrentModificationException.html]}}
> - if it is detected that the mapping function modified this map
> {quote}
> [Full documentation
> here|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function)]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)