bcicen/ctop · warning
attempting to reconnect...
Error message
attempting to reconnect...
What it means
The ConnectorSuper loop waits on the active connection; when conn.Wait() returns (connection closed), it sets the internal error to 'attempting to reconnect...' until the next loop iteration re-establishes the connection. Get() during this window returns this transient error.
Source
Thrown at connector/main.go:82
func (cs *ConnectorSuper) loop() {
const interval = 3
for {
log.Infof("initializing connector")
conn, err := cs.connFn()
if err != nil {
cs.setError(err)
log.Errorf("failed to initialize connector: %s (%T)", err, err)
log.Errorf("retrying in %ds", interval)
time.Sleep(interval * time.Second)
} else {
cs.conn = conn
cs.setError(nil)
log.Infof("successfully initialized connector")
// wait until connection closed
cs.conn.Wait()
cs.setError(fmt.Errorf("attempting to reconnect..."))
log.Infof("connector closed")
}
}
}
// Enabled returns names for all enabled connectors on the current platform
func Enabled() (a []string) {
for k, _ := range enabled {
a = append(a, k)
}
sort.Strings(a)
return a
}
// ByName returns a ConnectorSuper for a given name, or error if the connector
// does not exists on the current platform
func ByName(s string) (*ConnectorSuper, error) {
if cfn, ok := enabled[s]; ok {View on GitHub (pinned to 59f00dd6aa)
Solutions
- Retry Get() with backoff until reconnection completes (err becomes nil)
- Add reconnection event handling/logging around the connector lifecycle
- Verify the container/daemon is actually running if the error persists
Example fix
// before
conn, err := cs.Get() // fails once after daemon restart
// after
var conn connector.Connector
for i := 0; i < 10; i++ {
conn, err = cs.Get()
if err == nil { break }
time.Sleep(500 * time.Millisecond)
} Defensive patterns
Strategy: retry
Validate before calling
// detect reconnect window _, err := cs.Get() reconnecting := err != nil && err.Error() == "attempting to reconnect..."
Try / catch
conn, err := cs.Get()
if err != nil && err.Error() == "attempting to reconnect..." {
// retry with backoff; connection is re-established by the loop
time.Sleep(500 * time.Millisecond)
} Prevention
- Wrap Get() calls in a retry-with-backoff helper
- Monitor container/daemon health to anticipate drops
- Use exponential backoff with a max retry budget
When it happens
Trigger: The underlying connector's connection closes unexpectedly (container stopped, Docker daemon restart, network drop) and a Get() happens before the reconnect succeeds.
Common situations: Docker daemon restart while the app holds a connector; container stopped/removed underneath the client; transient network interruption in remote Docker setups.
Related errors
AI-assisted analysis of bcicen/ctop@59f00dd6aa (2026-09-02).
Data as JSON: /api/errors/66351c3b141c59dd.
Report an issue: GitHub.