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
MM-46402: Use pointer to pointer to set pointer to nil #20827
Conversation
@ashishbhate: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. I understand the commands that are listed here |
mut.Lock() | ||
defer mut.Unlock() | ||
if task != nil { | ||
task.Cancel() | ||
task = nil |
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.
Here just the local variable (task
) containing the pointer was being set to nil
.
We needed to set the pointer of the global task variable (a.ch.dndTask
or a.ch.postReminderTask
, depending on where this function was called) to nil.
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.
Aaaaah, this makes sense! Great catch, @ashishbhate, I completely missed this when first looking at the code. Thank you for the fix :)
I left a couple of optional comments below.
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.
Nice!
/e2e-test |
Successfully triggered e2e testing! |
@agarciamontoro I'm having trouble connecting to our internal servers. If the report is passing, could you please merge this PR? |
@ashishbhate It looks like it's not, it's failing in the report step. I'm not very familiar with these e2e tests yet. @agnivade, what's the usual process here? |
https://community.mattermost.com/private-core/pl/xwygwzxgdpgybpfoprfjy6wpjh You'll need to compare the failures against a recent master test run. Looking at the results, they look expected to me. Failures are unrelated. |
/cherry-pick cloud |
Cherry pick is scheduled. |
) Summary We need a pointer to a pointer to set the original pointer to nil The original task was not being set to nil (the local variable containing the pointer was being set to nil). The cancel function was being called even though the task had already been cancelled. This repeated cancellation was causing a panic because we were trying to close a channel that had already been closed the first time the task was cancelled. Ticket Link https://mattermost.atlassian.net/browse/MM-46402 (cherry picked from commit ff4406e)
Summary We need a pointer to a pointer to set the original pointer to nil The original task was not being set to nil (the local variable containing the pointer was being set to nil). The cancel function was being called even though the task had already been cancelled. This repeated cancellation was causing a panic because we were trying to close a channel that had already been closed the first time the task was cancelled. Ticket Link https://mattermost.atlassian.net/browse/MM-46402 (cherry picked from commit ff4406e) Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>
Summary
nil
(the local variable containing the pointer was being set to nil). The cancel func was being called even though the task had already been cancelled. This repeated cancellation was causing a panic because we were trying to close a channel that had already been closed the first time the task was cancelled.Ticket Link
Release Note