You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@helix.apache.org by "vlad.gm@gmail.com" <vl...@gmail.com> on 2014/11/14 02:17:42 UTC

race condition in Helix message handler factory registration

I have a small issue when running a Helix cluster in Docker (all on the
same machine, very small RTT):

I register two message handler factories, similarly to the way it is done
in BootstrapProcess.java example. The manager is not yet connected. My
understanding is that this places the handlers in a hashmap from which they
will be read and registered later, upon connect.

Upon connect, I see that the DefaultMessagingService.onConnected function
is called and Helix starts registering the message handlers. However,
messages start arriving already and HelixTaskExecutor.createMessageHandler
is called, before all handlers have been registered. The result is that I
get NullPointerExceptions for the missing handlers in the following line of
HelixTaskExecutor.createMessageHandler:

MessageHandlerFactory handlerFactory = item.factory();

due to the fact that there is no item (MessageHandlerFactoryRegistryItem)
for that message type registered yet.

I came upon this bug after updating the git code from an old snapshot of
0.7.1. I saw that the relevant code changes are from around the summer.

Regards,
Vlad

RE: race condition in Helix message handler factory registration

Posted by Zhen Zhang <zz...@linkedin.com>.
Hi Vlad, thanks. I created a jira to track this:
https://issues.apache.org/jira/browse/HELIX-548

Thanks,
Zhen

________________________________
From: vlad.gm@gmail.com [vlad.gm@gmail.com]
Sent: Thursday, November 13, 2014 5:17 PM
To: user@helix.apache.org
Subject: race condition in Helix message handler factory registration


I have a small issue when running a Helix cluster in Docker (all on the same machine, very small RTT):

I register two message handler factories, similarly to the way it is done in BootstrapProcess.java example. The manager is not yet connected. My understanding is that this places the handlers in a hashmap from which they will be read and registered later, upon connect.

Upon connect, I see that the DefaultMessagingService.onConnected function is called and Helix starts registering the message handlers. However, messages start arriving already and HelixTaskExecutor.createMessageHandler is called, before all handlers have been registered. The result is that I get NullPointerExceptions for the missing handlers in the following line of HelixTaskExecutor.createMessageHandler:

MessageHandlerFactory handlerFactory = item.factory();

due to the fact that there is no item (MessageHandlerFactoryRegistryItem) for that message type registered yet.

I came upon this bug after updating the git code from an old snapshot of 0.7.1. I saw that the relevant code changes are from around the summer.

Regards,
Vlad