You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everytime a pipeline is reloaded a connection is leaked.
For example a healthy non-reloaded pipeline doing jdbc work:
Then reload the pipeline ~10 times and the open/closed connections gap widens, and the number of noncollectable objects increase too.
Since we only use 1 connection (by default) and as of 4.3.0 open/close connections per statement, the gap between open and close should always be within 1.
The root cause here is that the underlying library does not guarantee a connection in use will actually get disconnected. From the underlying library disconnect method: "This method has the effect of disconnecting from the database, assuming that no connections are currently being used. "
We do not offer any assurances that the pipeline thread during a reload will not try to call disconnect while the connection is use. If that happens the library attempts to disconnect and looses it reference to the connection (thinking it is closed), but when in fact it is still open (since it is in use). Hence the connection leak. All the objects associated with the connection are leaked, hence the memory leak.
This issue will only impact consumers that reload frequently since the connection and memory leak is directly related to the reload frequency.
Note - 4.3.0 did not introduce this issue.
The text was updated successfully, but these errors were encountered:
jakelandis
added a commit
to jakelandis/logstash-input-jdbc
that referenced
this issue
Dec 6, 2017
When the pipeline reload thread closes the connection, but the connection is still active (becuase is executing a query), the connection and associated memory will leak. The underlying library does not make any assurances that the connection will indeed be closed if currently in use, and observation shows this to be true. The fix here is to ensure that the a thread can not attempt close the connection (it will block) while the connection is in use. In this case that thread is the pipeline thread and the reload will now block until the current query finishes (or errors).
Fixeslogstash-plugins#251
Testing against
5.6.4
with4.3.0
of this plugin.Everytime a pipeline is reloaded a connection is leaked.
For example a healthy non-reloaded pipeline doing jdbc work:
Then reload the pipeline ~10 times and the open/closed connections gap widens, and the number of noncollectable objects increase too.
Since we only use 1 connection (by default) and as of
4.3.0
open/close connections per statement, the gap between open and close should always be within 1.The root cause here is that the underlying library does not guarantee a connection in use will actually get disconnected. From the underlying library disconnect method: "This method has the effect of disconnecting from the database, assuming that no connections are currently being used. "
We do not offer any assurances that the pipeline thread during a reload will not try to call disconnect while the connection is use. If that happens the library attempts to disconnect and looses it reference to the connection (thinking it is closed), but when in fact it is still open (since it is in use). Hence the connection leak. All the objects associated with the connection are leaked, hence the memory leak.
This issue will only impact consumers that reload frequently since the connection and memory leak is directly related to the reload frequency.
Note -
4.3.0
did not introduce this issue.The text was updated successfully, but these errors were encountered: