Skip to content

Conversation

@anakin87
Copy link
Member

@anakin87 anakin87 commented Jan 22, 2026

Related Issues

#10341 (comment)

  Traceback (most recent call last):
    File "/Users/stefano.fiorucci/dev/haystack/haystack/components/generators/chat/hugging_face_local.py", line 259, in __del__
      if self._owns_executor:
  AttributeError: 'HuggingFaceLocalChatGenerator' object has no attribute '_owns_executor'

Not a test failure but I thought about improving a little bit this component, which sometimes also makes Windows tests hang in relation to executor deletion. So this change could help...

Proposed Changes:

  • invoke self.executor.shutdown only after checking its existence: at deletion time, it might happen that the class still exists but its attributes have already been deleted. Aligned with InMemoryDocumentStore:
    if hasattr(self, "_owns_executor") and self._owns_executor and hasattr(self, "executor"):

How did you test it?

CI

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@anakin87 anakin87 added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Jan 22, 2026
@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
haystack-docs Ignored Ignored Jan 22, 2026 3:45pm

Request Review

@anakin87 anakin87 changed the title chore: HuggingFaceLocalChatGenerator - check defensively before shutt… chore: HuggingFaceLocalChatGenerator - check defensively before shutting down executor Jan 22, 2026
@anakin87 anakin87 self-assigned this Jan 22, 2026
@anakin87 anakin87 marked this pull request as ready for review January 22, 2026 15:56
@anakin87 anakin87 requested a review from a team as a code owner January 22, 2026 15:56
@anakin87 anakin87 requested review from julian-risch and removed request for a team January 22, 2026 15:56
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@anakin87 anakin87 merged commit 38ad511 into main Jan 22, 2026
29 checks passed
@anakin87 anakin87 deleted the hf-local-check-executor branch January 22, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes PRs with this flag won't be included in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants