-
Notifications
You must be signed in to change notification settings - Fork 560
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
Automatic reconnect clarification #1210
Comments
@Arttii Hi! Is there any reason to use such an old version? |
@jkaflik That is a good point. We are planning to upgrade in the next few days. Do you think that could impact this? |
Upgrading did not really help. Same behavior on the app being inactive for a while |
@Arttii could you clarify this?
what does it mean? The query was blocked and no response came from the server. Is this TCP or HTTP protocol? |
We are using the TCP protocol, and yes, it seems no response came, and the query was blocked. The connection is concurrency safe, right? We have a pool being reused by several go routines at the same time. I will enable the debug logs and report back. |
@Arttii connection pool is safe, but the connection itself is not thread-safe. |
I am basically doing this: opts, err := clickhouse.ParseDSN(cfg.DataDBUrl)
if err != nil {
return err
}
clickhouseConn := clickhouse.OpenDB(opts)
clickhouseConn.SetMaxIdleConns(5)
clickhouseConn.SetMaxOpenConns(10) and the dns is something like this: Is there anything obvious that is wrong? |
Yes, How do you handle your connections? Are you sure you properly close all |
We just pass the pointer around to the gourotines. For querying, we use What is the best way to understand, which statements have an impact on this? Just looking at our metrics, i think you are right it seems its waiting for connections.
The wait duration specifically. Would setting |
Does it mean these queries do not finish on time? You can basically play with timeout context and see if these queries are problematic. Could you provide a code snippet more or less reflecting how you query? |
Describe the bug
In our app we use a shared instance of the stdLib connection, and today we had an instance of the connection seemingly not being alive any more. Queries were retried, but nothing was happening, which leads me to believe that maybe the connection was not up anymore?
Restarting the app, resolved the issue.
Expected behaviour
There are mentions of automatic reconnects in the lib, but was unable to find any docs on when and how this happens. I guess it should reconnect in this case?
Configuration
Environment
ClickHouse server
The text was updated successfully, but these errors were encountered: