Open cabouezzi opened 3 weeks ago
Hey @cabouezzi!
I'm here to help you out with any bugs, questions, and contributions you have in mind. Let's squash those bugs together while we wait for a human maintainer to join in.
To prevent the app from freezing when app.wait_for_feedback_results()
is called after a thread crashes, you can modify the _manage_pending_feedback_results
method to handle exceptions that might occur within the thread. This way, the thread can continue processing other records even if one of them causes an error.
Here is an example of how you can modify the _manage_pending_feedback_results
method to catch and log exceptions:
def _manage_pending_feedback_results(self) -> None:
"""Manage the queue of records with pending feedback results.
This is meant to be run permanently in a separate thread. It will
remove records from the queue records_with_pending_feedback_results as
their feedback results are computed and makes sure the queue does not
keep growing.
"""
while True:
try:
record = self.records_with_pending_feedback_results.get()
record.wait_for_feedback_results()
except Exception as e:
logger.error(f"Error processing feedback results: {e}")
# Optionally, you can add more error handling logic here
By wrapping the record.wait_for_feedback_results()
call in a try-except block, you ensure that any exceptions are caught and logged, preventing the thread from crashing and allowing it to continue processing other records [1].
To continue talking to Dosu, mention @dosu.
Hi @cabouezzi , I just added some functionality to App.wait_for_feedback_results
that might address this issue. There is now a default timeout. Check you can check it out before the next release by installing the branch in this PR: https://github.com/truera/trulens/pull/1267 .
Bug Description Using the vanilla relevance, context relevance, and groundedness feedback functions. Locally run custom app using Ollama as both responder and provider/judge. Firstly, there are errors occurring on separate threads (see traceback). The app doesn't crash, however
app.wait_for_feedback_results()
freezes the program if a thread crashes.To Reproduce Purposely crash one of the threads to see the freezing behavior. For the exact TimeOutError, perhaps use a large LLM that will take >10 minutes for responding. (Reasoning being it will occasionally say timed out after 600s, unable to reproduce however.)
Expected behavior A clear and concise description of what you expected to happen.
Relevant Logs/Tracebacks
(App continues to run after this error, but freezes)
Environment:
Additional context Custom app being used