Infinite loop in rare conditions
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?
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
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?
No logging at all (no HERE, no UNEXPECTED). Which is mind boggling to me :/
How can I activate the lib debug logging?
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.
Will do that and report, hopefully stumbling on it again quickly
(Depends a lot on health state of OpenAI API 😅)
Hi @spolu, just checking in, were you able to gather any logging for this issue?
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.
Closing out of inactivty