[
https://issues.apache.org/jira/browse/METRON-891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999473#comment-15999473
]
ASF GitHub Bot commented on METRON-891:
---------------------------------------
GitHub user jjmeyer0 opened a pull request:
https://github.com/apache/incubator-metron/pull/567
METRON-891: Changed Kafka API to Create a KafkaConsumer Per Request
## Contributor Comments
[Please place any comments here. A description of the problem/enhancement,
how to reproduce the issue, your testing methodology, etc.]
I stood up full-dev and made sure all kafka endpoints continue to work. I
also created a postman
[script](https://gist.github.com/jjmeyer0/49461a0665fd19a4cac5b2f31e524840)
that uses
[this](https://github.com/postmanlabs/newman/blob/develop/examples/parallel-collection-runs.js)
to execute the postman scripts in parallel. I executed a few thousand requests
against the API with no issue.
## Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our [Development
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
for the complete guide to follow for contributions.
Please refer also to our [Build Verification
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow
these guidelines and ask you to double check the following:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to
be created at [Metron
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x} Does your PR title start with METRON-XXXX where XXXX is the JIRA
number you are trying to resolve? Pay particular attention to the hyphen "-"
character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
### For code changes:
- [ ] Have you included steps to reproduce the behavior or problem that is
being changed or addressed?
- [ ] Have you included steps or a guide to how the change may be verified
and tested manually?
- [ ] Have you ensured that the full suite of tests and checks have been
executed in the root incubating-metron folder via:
```
mvn -q clean integration-test install && build_utils/verify_licenses.sh
```
- [x] Have you written or updated unit tests and or integration tests to
verify your changes?
- [x] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] Have you verified the basic functionality of the build by building
and running locally with Vagrant full-dev environment or the equivalent?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in
which it is rendered by building and verifying the site-book? If not then run
the following commands and the verify changes via
`site-book/target/site/index.html`:
```
cd site-book
mvn site
```
#### Note:
Please ensure that once the PR is submitted, you check travis-ci for build
issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up
for your personal repository such that your branches are built there before
submitting a pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jjmeyer0/incubator-metron METRON-891
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-metron/pull/567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #567
----
commit 226ef05d0e502e6cd10f8b20a3fe091d854d8a15
Author: JJ <[email protected]>
Date: 2017-04-27T16:40:59Z
METRON-891: Updated kafka service layer to fix some checkstyle issues.
commit 170c56624bea6a64936c53ef952aff3bf7caf62b
Author: JJ <[email protected]>
Date: 2017-04-28T20:24:26Z
METRON-891: Updated kafka to use spring's ConsumerFactory functionality for
Kafka. This will help with potential multi-threading issues.
commit c5ff40684973d8f127f81c35268a7436e7c286b2
Author: JJ <[email protected]>
Date: 2017-05-04T21:16:10Z
METRON-891: Fixed unit test issues and checkstyle issues.
----
> KafkaConsumer should not be shared among threads
> ------------------------------------------------
>
> Key: METRON-891
> URL: https://issues.apache.org/jira/browse/METRON-891
> Project: Metron
> Issue Type: Bug
> Reporter: Ryan Merriman
>
> The KafkaConsumer is created as a Spring bean in the REST application and is
> causing this error to periodically show up in the logs:
> SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with
> path [] threw exception [Request processing failed; nested exception is
> java.util.ConcurrentModificationException: KafkaConsumer is not safe for
> multi-threaded access] with root cause
> java.util.ConcurrentModificationException: KafkaConsumer is not safe for
> multi-threaded access
> at
> org.apache.kafka.clients.consumer.KafkaConsumer.acquire(KafkaConsumer.java:1431)
> at
> org.apache.kafka.clients.consumer.KafkaConsumer.listTopics(KafkaConsumer.java:1293)
> at
> org.apache.metron.rest.service.impl.KafkaServiceImpl.listTopics(KafkaServiceImpl.java:97)
> at
> org.apache.metron.rest.service.impl.KafkaServiceImpl.getSampleMessage(KafkaServiceImpl.java:107)
> at
> org.apache.metron.rest.controller.KafkaController.getSample(KafkaController.java:89)
> at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
> at
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
> at
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)