Skip to content

Conversation

@wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented Jan 24, 2026

Sync tasks broken in the following scenario:

  • _run_and_stop in runtime runs the task, and blocks on self.func() in task.execute
  • This raise never happens because this is in the main thread and the main thread is blocked on self.func().

The way around this is to create a new thread to run self.func

Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
@wild-endeavor wild-endeavor changed the title unblocked Use separate thread for running sync tasks Jan 26, 2026
@wild-endeavor wild-endeavor marked this pull request as ready for review January 26, 2026 18:01
v = await self.func(*args, **kwargs)
else:
v = self.func(*args, **kwargs)
copied_ctx = contextvars.copy_context()
Copy link
Contributor

Choose a reason for hiding this comment

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

lets move it to

await utils.asyncify(func, *args, **kwargs)

@kumare3 kumare3 self-requested a review January 26, 2026 20:01
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
@kumare3 kumare3 merged commit 35b1508 into main Jan 27, 2026
26 checks passed
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.

3 participants