Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The heartbeat timer for hazelcast client may stop on NullPointerException. #382

jansplichal opened this issue Dec 18, 2012 · 0 comments


None yet
2 participants
Copy link

commented Dec 18, 2012

Sometimes I can see this error in log:
Dec 18, 2012 1:25:59 PM com.hazelcast.client.ConnectionManager
WARNING: Server didn't respond to client's requests for 5 seconds. Assuming it is dead, closing the connection!
Exception in thread "Timer-0" java.lang.NullPointerException
at com.hazelcast.client.ConnectionManager$
at java.util.TimerThread.mainLoop(

I cannot reproduce it - but I think I know how to fix it.
When a hazelcast client is created, it starts a heartbeat timer.
If an exception from the run method of the TimerTask is not caught, the timer is stopped - and no further scheduling happens.

I think the patch bellow may fix it:

diff --git a/hazelcast-client/src/main/java/com/hazelcast/client/ b/hazelcast-client/src/main/java/com/hazelcast/client/
index 59a9697..2afa8de 100644
--- a/hazelcast-client/src/main/java/com/hazelcast/client/
+++ b/hazelcast-client/src/main/java/com/hazelcast/client/
@@ -95,7 +95,7 @@
                 } catch (InterruptedException e) {
-                } catch (IOException ignored) {
+                } catch (Exception ignored) {
         }, TIMEOUT, TIMEOUT / 10);

@pveentjer pveentjer closed this in f7b2afb Jul 16, 2013

mdogan added a commit that referenced this issue Jul 16, 2013

Merge pull request #563 from pveentjer/fix/2.x/382-heartbeattimer-har…

Fixes #382 where a NPE causes the TimerTask from running again.

@ghost ghost assigned pveentjer Jul 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.