[
https://issues.apache.org/jira/browse/ARTEMIS-2257?focusedWorklogId=212453&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-212453
]
ASF GitHub Bot logged work on ARTEMIS-2257:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 13/Mar/19 15:44
Start Date: 13/Mar/19 15:44
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on pull request #2558:
ARTEMIS-2257 Race condition when calling shutdownGracefully in
SharedEventLoopGroup
URL: https://github.com/apache/activemq-artemis/pull/2558#discussion_r265195488
##########
File path:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java
##########
@@ -84,30 +84,32 @@ public ThreadFactory run() {
@Override
public Future<?> shutdownGracefully(final long l, final long l2, final
TimeUnit timeUnit) {
- if (channelFactoryCount.decrementAndGet() == 0) {
- shutdown.compareAndSet(null, next().scheduleAtFixedRate(new
Runnable() {
- @Override
- public void run() {
- synchronized (SharedEventLoopGroup.class) {
- if (shutdown.get() != null) {
- Future<?> future =
SharedEventLoopGroup.super.shutdownGracefully(l, l2, timeUnit);
- future.addListener(new FutureListener<Object>() {
- @Override
- public void operationComplete(Future<Object> future)
throws Exception {
- if (future.isSuccess()) {
- terminationPromise.setSuccess(null);
- } else {
- terminationPromise.setFailure(future.cause());
+ synchronized (SharedEventLoopGroup.class) {
Review comment:
if you applied the synchronize here to this instead of .class I would be ok
with merging this without a test.
A synchornize on a .class here.. without a test.. I don't know what
implications it would have.
Can you tell me why the synchornize on the class was needed?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 212453)
Time Spent: 1h 20m (was: 1h 10m)
> Synchronize SharedEventLoopGroup shutdownGracefully to prevent race conditions
> ------------------------------------------------------------------------------
>
> Key: ARTEMIS-2257
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2257
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Affects Versions: 2.6.4
> Reporter: yangwei
> Priority: Critical
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> While thread a shutdowns shared event loop, between schedulingĀ a task and set
> the shutdown reference thread b calls getInstance() and retrieves ready
> shutting down instance. Add synchronized block to fix the problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)