[PR #43] [MERGED] Fix ModelVBAR __del__ shutdown error (control is None) #81

Closed
opened 2026-10-26 22:24:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-aimdo/pull/43
Author: @tvukovic-amd
Created: 4/29/2026
Status: ✅ Merged
Merged: 4/30/2026
Merged by: @rattus128

Base: master ← Head: fix/model-vbar-del-shutdown


📝 Commits (1)

  • bcb97b6 fix_vbar_del_attributeerror

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 comfy_aimdo/model_vbar.py (+4 -2)

📄 Description

On interpreter shutdown, Python prints ignored exceptions from ModelVBAR.__del__:

Exception ignored in: <function ModelVBAR.__del__ at 0x000002C57F716160>
Traceback (most recent call last):
  File "c:\develop\venv\Lib\site-packages\comfy_aimdo\model_vbar.py", line 122, in __del__
AttributeError: 'NoneType' object has no attribute 'lib'
Exception ignored in: <function ModelVBAR.__del__ at 0x000002C57F716160>
Traceback (most recent call last):
  File "c:\develop\venv\Lib\site-packages\comfy_aimdo\model_vbar.py", line 122, in __del__
AttributeError: 'NoneType' object has no attribute 'lib'

Root cause

When Python exits, it clears module variables in an unpredictable order. The name control can already be None when __del__ runs. The old check used control.lib, which raises the error above because you cannot read .lib on None.

Fix

  • Get the library with getattr(control, "lib", None) and only call vbar_free if that value is not None.
  • Get self._ptr with getattr(self, "_ptr", None) and only free if it is set.
  • Call vbar_free on that validated library object so teardown does not depend on a possibly cleared module-level lib alias.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-aimdo/pull/43 **Author:** [@tvukovic-amd](https://github.com/tvukovic-amd) **Created:** 4/29/2026 **Status:** ✅ Merged **Merged:** 4/30/2026 **Merged by:** [@rattus128](https://github.com/rattus128) **Base:** `master` ← **Head:** `fix/model-vbar-del-shutdown` --- ### 📝 Commits (1) - [`bcb97b6`](https://github.com/Comfy-Org/comfy-aimdo/commit/bcb97b6050a24bcc041ed33be90c7cf9cb1fef72) fix_vbar_del_attributeerror ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `comfy_aimdo/model_vbar.py` (+4 -2) </details> ### 📄 Description On interpreter shutdown, Python prints ignored exceptions from `ModelVBAR.__del__`: ``` Exception ignored in: <function ModelVBAR.__del__ at 0x000002C57F716160> Traceback (most recent call last): File "c:\develop\venv\Lib\site-packages\comfy_aimdo\model_vbar.py", line 122, in __del__ AttributeError: 'NoneType' object has no attribute 'lib' Exception ignored in: <function ModelVBAR.__del__ at 0x000002C57F716160> Traceback (most recent call last): File "c:\develop\venv\Lib\site-packages\comfy_aimdo\model_vbar.py", line 122, in __del__ AttributeError: 'NoneType' object has no attribute 'lib' ``` Root cause When Python exits, it clears module variables in an unpredictable order. The name control can already be `None` when `__del__` runs. The old check used `control.lib`, which raises the error above because you cannot read `.lib` on `None`. Fix - Get the library with `getattr(control, "lib", None)` and only call `vbar_free` if that value is not `None`. - Get `self._ptr` with `getattr(self, "_ptr", None)` and only free if it is set. - Call `vbar_free` on that validated library object so teardown does not depend on a possibly cleared module-level lib alias. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:24:23 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-aimdo#81
No description provided.