Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Jul 22, 2025

Describe your changes

This improves our bootstrap logic and prevents the confusing RuntimeError: no running event loop message from being displayed on unrelated errors. In the current state, if asyncio.run(main()) throws an uncaught exception, it will always show as:

RuntimeError: no running event loop

During handling of the above exception, another exception occurred:

since the exception is thrown within the except RuntimeError block. This is confusing since the RuntimeError is expected.

Testing Plan

  • Existing logic should cover this well.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Jul 22, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 22, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12008/streamlit-1.47.0-py3-none-any.whl
🕹️ Preview app pr-12008.streamlit.app (☁️ Deploy here if not accessible)

task = asyncio.create_task(main(), name="bootstrap.run_server")
# Store task reference on the server to keep it alive
# This prevents the task from being garbage collected
server._bootstrap_task = task
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Our linting recommends to keep a task reference to prevent this from being garbage collected.

@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:other PR contains other type of change impact:users PR changes affect end users labels Jul 22, 2025
@lukasmasuch lukasmasuch requested a review from a team as a code owner July 22, 2025 11:34
@lukasmasuch lukasmasuch merged commit ec45ce6 into develop Jul 23, 2025
38 checks passed
@lukasmasuch lukasmasuch deleted the fix/bootstrap-event-loop-logic branch July 23, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:other PR contains other type of change impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants