Closed SoftMemes closed 7 years ago
The error comes from Netty:
[esio-1-1] - i.n.c.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception."
If your jvm heap size is too small, try:
-Xmx<size>
eventstore.subscribeToAllFrom(
Position.START,
CatchUpSubscriptionSettings.newBuilder()
.readBatchSize(10)
.build(),
(s, e) -> System.out.println("event: " + e)
);
eventstore.subscribeToAllFrom(
Position.START,
CatchUpSubscriptionSettings.newBuilder()
.maxLiveQueueSize(100)
.build(),
(s, e) -> System.out.println("event: " + e)
);
If you want to be informed when the subscription is closed - you should implement onClose(...)
listener method e.g.:
eventstore.subscribeToAllFrom(Position.START, new CatchUpSubscriptionListener() {
@Override
public void onEvent(CatchUpSubscription subscription, ResolvedEvent event) {
System.out.println("onEvent: " + event);
}
@Override
public void onClose(CatchUpSubscription subscription, SubscriptionDropReason reason, Exception exception) {
System.out.println("onClose: reason=" + reason + "; exception=" + exception);
}
});
...anyway, there is small issue here with client behavior when error occurs before tcp package handling. In such cases as this, the .net client closes tcp connection: https://github.com/EventStore/EventStore/blob/release-v4.0.0/src/EventStore.ClientAPI/Transport.Tcp/TcpPackageConnection.cs#L123
Thanks for the reply. We've addressed root cause with the methods you describe (buffer size and heap), but the problem was that the client did not call the onClose handler - which meant our automatic restarts, monitoring etc did not kick in. Will the fix you referenced address this, or does it relate to something else?
Yes. If there will be an error while processing tcp package, the client will close all subscriptions (as a result subscription listener onClose()
will be called) and disconnect.
We have some fairly large events in EventStore and subscribe with a catch-up subscripiton. It appears that under some circumstances, this causes the subscription to die silently due to OOM - we are no longer receiving messages on the subscription, but are also not informed in any way of the fact that the subscription dies. The connection to eventstore is still live.
Stack traces from our logs: