<p>The server stops at a debug synchronization point more times than the defined hit limit, triggering ER_DEBUG_SYNC_HIT_LIMIT.</p>
<p>MySQL Error 1640 ER_DEBUG_SYNC_HIT_LIMIT occurs when a debug sync point is reached more times than its hit_limit parameter allows. Increase or clear the hit limit, or disable DEBUG_SYNC, to resolve the issue.</p>
debug sync point hit limit reached
The message debug sync point hit limit reached signals that a debug synchronization point has been executed more times than permitted by its hit_limit setting. MySQL halts the targeted session to prevent runaway debugging loops.
Debug sync points are an internal testing feature, activated with SET DEBUG_SYNC. They are normally disabled in production builds, but can surface in custom or debug-enabled servers.
The error appears immediately after the sync point counter exceeds the limit. Typical contexts include automated test suites, stored procedures exercising edge cases, or mis-configured replication tests.
Developers sometimes unknowingly ship code that leaves DEBUG_SYNC statements active, causing the error after deployment to a debug build.
Primary cause is a mismatch between the actual number of hits and the value set in hit_limit for a given sync point.
It may also arise if a loop triggers the same sync point repeatedly without resetting or clearing the counter, leading to exhaustion of the limit.
Clear or raise the hit limit with SET DEBUG_SYNC. Disable the sync facility if no longer required. Review code to remove lingering DEBUG_SYNC calls.
If the server is compiled without debug_sync support, switch to a production build to prevent accidental activation.
In stress tests, increase hit_limit to a higher value so the loop can finish. In unit tests, lower hit_limit and reset it between cases to isolate failures.
During replication testing, ensure each replica resets its own counters so sync points do not accumulate across test phases.
Always wrap DEBUG_SYNC activation in conditional debug flags. Clean up with SET DEBUG_SYNC = 'RESET' at the end of each test.
Monitor server error logs in CI pipelines to catch ER_DEBUG_SYNC_HIT_LIMIT early. Use Galaxy's query history to verify no DEBUG_SYNC commands reach production databases.
ER_DEBUG_SYNC_TIMEOUT is thrown when a session waits too long at a sync point. ER_VARIABLE_IS_READONLY appears if attempting to modify debug_sync on a release build. Address these by adjusting debug_sync_timeout or switching to a debug-enabled server respectively.
Automated loops hit the same sync point thousands of times without resetting, quickly exhausting hit_limit.
Developers leave SET DEBUG_SYNC commands in stored procedures, causing unexpected hits after deployment.
Using the default hit_limit of 1 while expecting multiple executions leads to rapid limit breaches.
Raised when a session waits longer than debug_sync_timeout at a sync point.
Occurs if attempting to modify debug_sync on a non-debug build.
Triggered when a required test plugin is missing during debug synchronization.
No. Official production builds disable debug_sync, so ER_DEBUG_SYNC_HIT_LIMIT appears only in custom debug builds.
Ignoring is safe only in test environments. In production, remove or disable debug_sync to avoid unexpected halts.
Check the error log entry; it records the sync point name and session ID. You can then search your test scripts or procedures.
Yes. Galaxy highlights DEBUG_SYNC statements in the editor and warns before running them against production connections, reducing accidental activation.