Closing client on shutdown


(Vasiliy S) #1

Hi there,

According documentationhttp://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html,
I need to close client on shutdown. What will be if don't do that? May it
cause to memory leak on elasticsearch server side? Say, JVM with my
application just shutdown unexpectedly without closing client. How will it
affect on elasticsearch server that is launched in different JVM?

Thanks,
Vasiliy

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3a33341b-9946-4953-9544-5e021fd05f67%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #2

If client is shutdown unexpectedly, there will be errors in the server log,
something like "connection reset by peer", "closed", "interrupted", "read
error", "broken pipe", whatever. Active operations may complete, but
responses can not be sent back.

If you do not close a transport client, the thread pool and socket
connection pool will stay active and open unless you shut down the whole
JVM.

A node client does not have a thread pool or connection pool, it is tied to
the underlying node, and also in this case, unless you close the node, the
node thread pool and node connection pool will stay open.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGSE%2B_ZN8kra%3DAbVAFeVqYnwPpbcDJzQR9VCGVRUf21qg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Vasiliy S) #3

Hi Jörg,

Thank you for your reply.
Just to clarify I want to ask again. I'm using transport client on my
client side. It's possible in my case that client JVM can be just turned
off. Elasticsearch server is run on a different machine. Will there be some
issues with elasticsearch (besides errors in logs) if I my client JVM is
disabled by some reason?

Thanks,
Vasiliy

On Tuesday, December 3, 2013 5:55:16 PM UTC+9, Jörg Prante wrote:

If client is shutdown unexpectedly, there will be errors in the server
log, something like "connection reset by peer", "closed", "interrupted",
"read error", "broken pipe", whatever. Active operations may complete, but
responses can not be sent back.

If you do not close a transport client, the thread pool and socket
connection pool will stay active and open unless you shut down the whole
JVM.

A node client does not have a thread pool or connection pool, it is tied
to the underlying node, and also in this case, unless you close the node,
the node thread pool and node connection pool will stay open.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9b151bf4-6415-4136-9919-86872eaad16b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #4

The issues are dropped connections, and maybe lost documents when indexing
is active.

You were asking about memory leaks. This is only one type of bugs. There
have been some Netty 3-related bugs a while ago, the epoll bug for example
(< 3.2.6)

It always depends on the versions, if there are known bugs or not.

This is one of the reasons why Netty 4 is not yet integrated into ES I
guess. There is a certain risk of yet undiscovered resource leaks, such as
https://github.com/netty/netty/issues/1621 or
https://github.com/netty/netty/issues/1624

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHTnhSdDV%2BJGof4Mnk127kwhihggOMMuaqqnH-1GkZ-Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Vasiliy S) #5

I see your point. Thank you for reply. It's better to try to close client
in such a case.

Cheers,
Vasiliy

On Tuesday, December 3, 2013 6:47:24 PM UTC+9, Jörg Prante wrote:

The issues are dropped connections, and maybe lost documents when indexing
is active.

You were asking about memory leaks. This is only one type of bugs. There
have been some Netty 3-related bugs a while ago, the epoll bug for example
(< 3.2.6)

It always depends on the versions, if there are known bugs or not.

This is one of the reasons why Netty 4 is not yet integrated into ES I
guess. There is a certain risk of yet undiscovered resource leaks, such as
https://github.com/netty/netty/issues/1621 or
https://github.com/netty/netty/issues/1624

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9fbc6907-4c7b-4abe-a862-f3fa47d54ff7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6