-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix: resolve doubly linked list push issue #3085
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
Fix: resolve doubly linked list push issue #3085
Conversation
@ntvviktor looks like you broke the tests |
hey nkaradzhov, I am considering, even though fixing the code logic of the DoublyLinkedList will properly shut down the bad host request for redis connection, but it will break the sentinel client tests. I believe it has been somehow coded to pass with the error of issue: TypeError: Cannot set properties of undefined (setting 'next')
File "/app/node_modules/.pnpm/@[email protected]/node_modules/@redis/client/dist/lib/client/linked-list.js", line 76, col 32, in DoublyLinkedList.remove
node.previous.next = node.next; I will investigate further to try to triage and fix the root cause. |
In the case of the issue above, seems like the async #create() {
const node = this._self.#clientsInUse.push(
this._self.#clientFactory()
.on('error', (err: Error) => this.emit('error', err))
);
try {
const client = node.value;
await client.connect();
} catch (err) {
this._self.#clientsInUse.remove(node);
throw err;
}
this._self.#returnClient(node);
} I fix using the if statement to check for the previous is not enough, and found out a root cause from RedisCommandQueue also using Doubly Linked List. I ran all tests locally and it currently works as expected. @nkaradzhov Please help me enable the pipeline to see whether my fix break anything. Thanks! |
Hi @nkaradzhov, please help me review the code, thanks in advance |
@ntvviktor the PR looks to be damaged somehow, it looks like ther are some unwanted changes after a merge? |
c03c34f
to
234f1b6
Compare
Hi @nkaradzhov thanks for feedback, I have made changes, my bad on the rebase master branch into this. |
@ntvviktor sorry for being paranoid here, but could you please provide a test case for the DoublyLinkedList somewhere here |
Thanks @nkaradzhov, I have added the according tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLGTM
Description
Now the client pool properly shut down after getting a bad connection.
Checklist
npm test
pass with this change (including linting)?