-
Notifications
You must be signed in to change notification settings - Fork 26
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
PooledConnectionFactory connected/disconnected events #242
Comments
Defining what healthy means can be tricky. Are you measuring the health of the LDAP itself, the network path (including load balancers) or just the health of any single connection? If I can connect but searches are failing, is that healthy? I think in general you want to communicate the health of the service as a whole, but it's worth calling out what that means. Connections are closed for various reason that don't necessarily indicate a problem. TCP timeouts may be a normal and expected event. LDAP servers behind load balancers may be restarted regularly, forcing connections to be reopened and may cause intermittent connection failures. That said, most of the solutions I've seen test whether a connection can be opened and/or a search is successful. They either use a If you're looking for richer metadata about what is happening in the pool, we'll need to make some API changes to expose those events. I am making some improvements to the |
No, posting here is fine. I'm holding my breath that github will provide that sort of functionality (for free). |
OK, then I guess I have two different follow-up questions:
In my particular use case, I think the majority of the connection issues are when the backend server is just completely shut down, and netty cant connect or reconnect. |
I think the answer to that depends on your logging backend. For instance, if you're using logback I believe you can set the loglevel to
The validator in the pool runs on a set period, so it will attempt to validate any connections not in use and bring the pool up to it's configured minSize every time it runs. |
Ok, thanks. With your help, I can now make it do what I need. If i set connectOnCreate(false) and minSize(1) and set a connection validator with periodic validation and a validationexceptionhandler... i can wrap up all the events and just set my service to up or down. I still think... at least the stack traces and error levels on the ldaptive exceptions could be removed or changed to DEBUG. Or have that exception logging be a default handler or something, that could be replaced in configuration. I don't need the
because I can tell its not up from the ConnectionValidator. I don't need the
because the very next thing it does is call my ValidationExceptionHandler with that same exception. The problem with the logs is
|
Prefer debug to warn for validation error logging. Prefer debug when logging prior to throwing an exception. Prefer debug when closing or tearing down resources. See #242.
What is the best way to simply check if a PooledConnectionFactory is healthy or not? As in, if it received connection errors or not on it's last connection attempts, and/or has 0 active and 0 available connections? I just want to notify my application when the remote ldap connection is down, and then back up.
Is there a way to get events from the PooledConnectionFactory when it's underlying connections open, fail, and re-open?
The situation I see is when the remote server goes down, I get these exception in the log at ERROR level.
I want to capture those exceptions, log them internally as DEBUG, and then event to the rest of my app that ldap is down (ui widget, etc). It's all reactive. But I don't see anywhere at the PooledConnectionFactory or DefaultConnectionFactory to capture these exceptions or put in a customized handler of some type.
For healthy I could put a connection activator on the factory or something to just set it to healthy maybe?
I've looked through the user guide, javadocs, and now am digging through the code looking for a good place to put this.
I could periodically poll the pooled connection factory i think, but i wanted to see if you have a hook for this. What would that polling look like? If i set minPoolSize to 1, and activeCount and availableCount are both 0, then that is unhealthy?
Also, do you have a discord or somewhere to chat these kinds of questions instead of opening issues? Sorry for asking this as an issue.
The text was updated successfully, but these errors were encountered: