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

Isolate call to Network::fetch() outside of runtime to prevent panic #1767

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

pronebird
Copy link
Contributor

@pronebird pronebird commented Dec 10, 2024

The following panic has been thrown each time the windows service started:

Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.

I figured that a call to Network::fetch() calls tokio::runtime::block_on() while the outer scope of the service is already running within a runtime. This PR simply moves the blocking call outside of our runtime.

Ideally we should find a way to make this call async and move it after reporting the StartPending status to the service control manager (SCM) perhaps giving it a time hint to prevent it from killing the service too soon.

But as a temporary solution this should probably work.


This change is Reviewable

Panic says: Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.
@pronebird pronebird requested a review from octol December 10, 2024 12:18
@pronebird pronebird merged commit eb0b27a into develop Dec 10, 2024
10 of 11 checks passed
@pronebird pronebird deleted the am/win-rt-crash branch December 10, 2024 12:30
pronebird added a commit that referenced this pull request Dec 10, 2024
…1767)

Panic says: Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.
pronebird added a commit that referenced this pull request Dec 10, 2024
* Disable colors in file log (#1766)

* Isolate call to Network::fetch() outside of runtime to prevent panic (#1767)

Panic says: Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.
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