potiuk commented on pull request #14792:
URL: https://github.com/apache/airflow/pull/14792#issuecomment-800681024


   Hey @ashb  - unfortunately we cannot and should not use `_del_` method. This 
what I was afraid of but SchedulerJob is not an ordinrary class - this is an 
SQLAlchemy managed class and (as I was afraid) __del__ will not run well for 
this class because SQL Alchemy will introduce reference cycles and __del__ will 
not work in this case. So far I was only suspecting this but now I am quite 
sure of that, This is the warning printed by SQLAlchemy:
   
   ```
     
/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/instrumentation.py:93 
SAWarning: __del__() method on class <class 
'airflow.jobs.scheduler_job.SchedulerJob'> will cause unreachable cycles and 
memory leaks, as SQLAlchemy instrumentation often creates reference cycles.  
Please remove this method.
   ```
   
   It's difficult to argue with this. I had the same feeling when I read how 
__dell__ and reference counting works and when I saw SchedulerJob being the ORM 
class. But now I am 100% sure it was a bad idea.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to