-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Chatlog: Add minimal DB retry logic #10774
Open
DieterReinert
wants to merge
13
commits into
smogon:master
Choose a base branch
from
DieterReinert:patch-6
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We encountered a crash on a chat page with the following stack trace: ```TS A chat page crashed: error: restart transaction: TransactionRetryWithProtoRefreshError: ReadWithinUncertaintyIntervalError: read at time 1735344596.246113077,0 encountered previous write with future timestamp 1735344596.478577328,0 within uncertainty interval `t <= (local=1735344596.746113077,0, global=1735344596.746113077,0)`; observed timestamps: [{2 1735344598.610798995,0} {3 1735344596.246113077,0}]: "sql txn" meta={id=a54c7d78 key=/Min pri=0.01119841 epo=0 ts=1735344596.246113077,0 min=1735344596.246113077,0 seq=0} lock=false stat=PENDING rts=1735344596.246113077,0 wto=false gul=1735344596.746113077,0 at /home/ps/main/node_modules/pg-pool/index.js:45:11 at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.list (/home/ps/main/server/chat-plugins/chatlog.ts:122:20) at Object.listCategorized (/home/ps/main/server/chat-plugins/chatlog.ts:130:16) at Object.list (/home/ps/main/server/chat-plugins/chatlog.ts:432:16) at PageContext.resolve (/home/ps/main/server/chat.ts:471:10) at CommandContext.join (/home/ps/main/server/chat-commands/moderation.ts:503:15) ``` This PR adds a small generic helper function to re-run queries when any error occurs, up to a limited number of retries.
…iline) without changing functionality.
…ed template call.
We could potentially add or improve these things in our
|
DieterReinert
changed the title
Add minimal generic retry logic to handle transient DB errors
Chatlog: Add minimal DB retry logic
Dec 31, 2024
Another Stack Trace: A chat page crashed: error: restart transaction: TransactionRetryWithProtoRefreshError: ReadWithinUncertaintyIntervalError: read at time 1736859296.170169540,0 encountered previous write with future timestamp 1736859296.456404574,0 within uncertainty interval `t <= (local=1736859296.670169540,0, global=1736859296.670169540,0)`; observed timestamps: [{1 1736859296.170169540,0} {2 1736859298.725285111,0} {3 1736859296.172367391,0}]: "sql txn" meta={id=9145c423 key=/Min pri=0.02228827 epo=0 ts=1736859296.170169540,0 min=1736859296.170169540,0 seq=0} lock=false stat=PENDING rts=1736859296.170169540,0 wto=false gul=1736859296.670169540,0
at /home/ps/main/node_modules/pg-pool/index.js:45:11
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Object.list (/home/ps/main/server/chat-plugins/chatlog.ts:122:20)
at Object.listCategorized (/home/ps/main/server/chat-plugins/chatlog.ts:130:16)
at Object.list (/home/ps/main/server/chat-plugins/chatlog.ts:432:16)
at PageContext.resolve (/home/ps/main/server/chat.ts:471:10)
at CommandContext.join (/home/ps/main/server/chat-commands/moderation.ts:503:15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We encountered a crash on a chat page with the following stack trace:
This PR adds a small generic helper function to re-run queries when any error occurs, up to a limited number of retries.