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

Infinite loop in rare conditions #46

Closed
spolu opened this issue Feb 15, 2023 · 9 comments
Closed

Infinite loop in rare conditions #46

spolu opened this issue Feb 15, 2023 · 9 comments

Comments

@spolu
Copy link

spolu commented Feb 15, 2023

Here's a piece of code that uses event-source and leads in rare cases to an infinite loop:
https://github.com/dust-tt/dust/blob/fbced883d7e62d8c69624c5d19e48dbe9d8e9708/core/src/providers/openai.rs#L189-L332

I was able to profile the program and got the following flamegraph. Looks like it's looping inside of eventsource-client?
test

@spolu
Copy link
Author

spolu commented Feb 15, 2023

Maybe it's caused by the fact that I have reconnects deactivated?
https://github.com/launchdarkly/rust-eventsource-client/blob/main/eventsource-client/src/client.rs#L469-L475

@keelerm84
Copy link
Member

I'm sorry you are experiencing this issue!

In both the event source library, and in the example you provided, there are several bits of logging information which might help us uncover some more insight into when this is happening.

Can you please provide some sample logging output when this issue occurs?

@spolu
Copy link
Author

spolu commented Feb 15, 2023

No logging at all (no HERE, no UNEXPECTED). Which is mind boggling to me :/

How can I activate the lib debug logging?

@keelerm84
Copy link
Member

We use the log crate for logging. So you just need to initialize some logger that is compatible with that (e.g. env_logger) and then run your app with the appropriate RUST_LOG=evensource=trace level.

@spolu
Copy link
Author

spolu commented Feb 15, 2023

Will do that and report, hopefully stumbling on it again quickly

@spolu
Copy link
Author

spolu commented Feb 15, 2023

(Depends a lot on health state of OpenAI API 😅)

@cwaldren-ld
Copy link
Contributor

Hi @spolu, just checking in, were you able to gather any logging for this issue?

@spolu
Copy link
Author

spolu commented Mar 5, 2023

The issue vanished by adding ReconnectOptions: https://github.com/dust-tt/dust/blob/main/core/src/providers/openai.rs#L241-L246

That does not resolve the whole problem. But at least that's an interesting hint.

@spolu
Copy link
Author

spolu commented May 31, 2024

Closing out of inactivty

@spolu spolu closed this as completed May 31, 2024
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

No branches or pull requests

3 participants