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

Extreme CPU usage #77

Closed
010011x opened this issue Jun 7, 2023 · 3 comments · Fixed by #78 or OpenBB-finance/OpenBB#5122
Closed

Extreme CPU usage #77

010011x opened this issue Jun 7, 2023 · 3 comments · Fixed by #78 or OpenBB-finance/OpenBB#5122

Comments

@010011x
Copy link

010011x commented Jun 7, 2023

This is continuation of this issue

OpenBB-finance/OpenBB#5104

Just running this example

import asyncio
import sys

from pywry import PyWry


async def main_loop():
    while True:
        await asyncio.sleep(1)


if __name__ == "__main__":
    try:
        handler = PyWry()
        handler.send_html("<h1 style='color: red;'>Welcome to PyWry!</h1>")
        handler.start()

        # PyWry creates a new thread for the backend,
        # so we need to run the main loop in the main thread.
        # otherwise, the program will exit immediately.
        handler.loop.run_until_complete(main_loop())
    except KeyboardInterrupt:
        print("Keyboard interrupt detected. Exiting...")
        sys.exit(0)

Gives 100 CPU usage. Why is that ? This consumes more cpu than anything else in openbb.

Is it busy waiting ?
Is it missing asyncio.sleep somewhere?

@andrewkenreich
Copy link
Collaborator

hey @010011x we are able to replicate this - looking into it!

@tehcoderer tehcoderer mentioned this issue Jun 8, 2023
@tehcoderer
Copy link
Collaborator

Hey @010011x ! Thank you for bringing this to our attention.

I spent all day today pulling my hair looking for the cause of this issue 😅, but the good news is I was able to pin point the cause of the CPU buffet fest lol.

image

🎊🚀 Running new build v0.5.12 that should be installable in the next 15mins!

Thanks again for posting this Issue!

@010011x
Copy link
Author

010011x commented Jun 9, 2023

Hey @010011x ! Thank you for bringing this to our attention.

I spent all day today pulling my hair looking for the cause of this issue sweat_smile, but the good news is I was able to pin point the cause of the CPU buffet fest lol.

image

confetti_ballrocket Running new build v0.5.12 that should be installable in the next 15mins!

Thanks again for posting this Issue!

great job !!! 🚀 that was really fast! thanks a lot!

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 a pull request may close this issue.

3 participants