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

Client connection lost during heartbeat timeout #17

Closed
amri opened this issue Aug 13, 2016 · 4 comments
Closed

Client connection lost during heartbeat timeout #17

amri opened this issue Aug 13, 2016 · 4 comments
Labels

Comments

@amri
Copy link

amri commented Aug 13, 2016

Hi,

I've been investigating issue where my js code intermittenly stop pushing event to eventstore. Once I put some logging i found these:

[PID:01424:012 2016.08.13 15:07:30.341 TRACE TcpConnectionManager] Closing connection 'external-normal' [127.0.0.1:61047, L127.0.0.1:1113, {7c3c6a87-ec80-404c-b0f5-916f7ef81e72}] cleanly. Reason: HEARTBEAT TIMEOUT at msgNum 3742004
[PID:01424:012 2016.08.13 15:07:30.341 INFO  TcpConnection       ] ES TcpConnection closed [15:07:30.341: N127.0.0.1:61047, L127.0.0.1:1113, {7c3c6a87-ec80-404c-b0f5-916f7ef81e72}]:Received bytes: 284729333, Sent bytes: 6448674876
[PID:01424:012 2016.08.13 15:07:30.341 INFO  TcpConnection       ] ES TcpConnection closed [15:07:30.341: N127.0.0.1:61047, L127.0.0.1:1113, {7c3c6a87-ec80-404c-b0f5-916f7ef81e72}]:Send calls: 3741924, callbacks: 3741924
[PID:01424:012 2016.08.13 15:07:30.341 INFO  TcpConnection       ] ES TcpConnection closed [15:07:30.341: N127.0.0.1:61047, L127.0.0.1:1113, {7c3c6a87-ec80-404c-b0f5-916f7ef81e72}]:Receive calls: 3742005, callbacks: 3742004
[PID:01424:012 2016.08.13 15:07:30.341 INFO  TcpConnection       ] ES TcpConnection closed [15:07:30.341: N127.0.0.1:61047, L127.0.0.1:1113, {7c3c6a87-ec80-404c-b0f5-916f7ef81e72}]:Close reason: [Success] HEARTBEAT TIMEOUT at msgNum 3742004

I found in .NET client library have the functionality:

connectionSettingsBuilder.KeepReconnecting();
connectionSettingsBuilder.KeepRetrying();

Is there a workaround for this issue ? or should I reconnect when onError / onClosed event called ?

@coreyperkins
Copy link

I reset my connection onError (via the options) then hook my subscription back up. It works fine, but I would also like the ability to have this lib do that for me.

@x-cubed
Copy link
Owner

x-cubed commented Sep 16, 2016

Feel free to submit a pull request to implement support for this.
All contributions are gratefully received.

@amri
Copy link
Author

amri commented Sep 16, 2016

@coreyperkins how do you reconnect onError ?

@coreyperkins
Copy link

coreyperkins commented Sep 16, 2016

@amri In my options I define the onError handler like so.

var sourceOptions = {
  host: sourceConfig.eventStore.address,
  port: sourceConfig.eventStore.port,
  debug: sourceConfig.debug,
  credentials: sourceConfig.eventStore.credentials,
  streamId: sourceConfig.eventStore.stream,
  onError: function(err) {
    console.error('There was an error connecting to the source es!');
    console.error(err);
    console.error(err.stack);

    subscribe();
  }
};

Then in the subscribe function I simply make a call to connection.subscribeToStreamFrom providing the last check point I successfully got to.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants