ialarmedalien opened a new pull request, #4464:
URL: https://github.com/apache/iceberg-python/pull/4464

   # Rationale for this change
   
   Currently, if using an `InMemoryCatalog` (in-memory sqlite catalog) in a 
worker thread, closing or garbage collecting in the main thread raises an 
`sqlite3.ProgrammingError`. SQLAlchemy's `Pool._close_connection()` catches the 
exception, logs an `ERROR` traceback on `sqlalchemy.pool`, and leaves the 
underlying `sqlite3.Connection` open, which subsequently emits 
`ResourceWarning: unclosed database on GC (Python 3.13+)`.
   
   The same thing happens if >5 worker threads touch a `:memory:` catalog 
(`SingletonThreadPool._cleanup()`).
   
   This PR sets the `check_same_thread` connection argument to `False` to allow 
the connection to be closed and garbage collection to occur.
   
   ## Are these changes tested?
   
   Yes -- see new tests:
   - close / garbage collection from a different thread succeeds
   - other operations remain single-thread only
   - explicit `check_same_thread` params are respected
   
   ## Are there any user-facing changes?
   
   No API changes.


-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to