Skip to content

try to handle properly error#106

Merged
fcostaoliveira merged 1 commit intomasterfrom
joan-try-fix-stuck
Apr 14, 2026
Merged

try to handle properly error#106
fcostaoliveira merged 1 commit intomasterfrom
joan-try-fix-stuck

Conversation

@JoanFM
Copy link
Copy Markdown
Contributor

@JoanFM JoanFM commented Apr 14, 2026

Problem

When Redis returns an error like OOM ftsb_redisearch gets stuck and no more commands are sent to the server.

Each worker uses a radix.Pool with a single connection. When Redis returns an error, the server may close the connection. But the radix pool doesn't know the connection is dead — it tries to reuse it for the next command. The write might go through (buffered in TCP), but the read hangs waiting for a response that never comes. The worker blocks, stops sending ACKs to the scanner, and the whole pipeline freezes.

Fix

  1. Extracted connection creation into reusable helpersgetDialOpts(), getCustomConnFunc(), and createPool() — so the same pool configuration can be used both at init and when reconnecting.

  2. Added reconnectPool() — a method that closes the existing pool and creates a fresh one. It logs success/failure and respects the --continue-on-error flag.

  3. Propagated error status up the call chainsendIfRequired and sendFlatCmd now return a bool hadError so the caller knows when something went wrong.

  4. Reconnect after errors in connectionProcessor — when a command fails in non-cluster mode and --continue-on-error is enabled, it immediately closes the old pool and creates a new connection before sending the next command. This prevents hanging on a broken/half-closed connection.

  5. Improved Close() cleanup — properly closes pool and cluster connections when the processor shuts down.

Result

Instead of getting stuck forever after an OOM (or similar) error, the tool reconnects and continues benchmarking. The reconnection is logged as "Successfully reconnected to Redis after error".

@JoanFM JoanFM requested a review from fcostaoliveira April 14, 2026 16:59
@sonarqubecloud
Copy link
Copy Markdown

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Apr 14, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@fcostaoliveira fcostaoliveira merged commit 24a618a into master Apr 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants