Skip to content
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 waitForEvent when taskqueue closed before the task is executed #1494

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Oct 18, 2024

What?

Adding a context.Done() check so that when the context is closed we can carry on with shutting down of the iteration and not wait for the task to run (which will not happen since the taskqueue will have also been shutdown either from here, or here).

Why?

If the taskqueue is closed before all the tasks are read from the queue, the remaining tasks on the queue will not be read and executed and so the done channel will not be closed causing the goroutine to wait forever.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Related: #1493

@ankur22 ankur22 requested a review from inancgumus October 18, 2024 16:52
If the context is done before all the tasks are read from the queue,
the remaining tasks on the queue will not be read and so the done
channel will not be closed causing the goroutine to wait forever.

This is solved by adding a context.Done() check so that when the
context is closed we can carry on with shutting down of the iteration.
@ankur22 ankur22 force-pushed the fix/memory-leak-in-pageWaitForEvent branch from d651ebc to 9b41547 Compare October 18, 2024 16:52
Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was like Deja vu!

@ankur22 ankur22 merged commit 135e886 into main Oct 25, 2024
23 checks passed
@ankur22 ankur22 deleted the fix/memory-leak-in-pageWaitForEvent branch October 25, 2024 09:37
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