Copilot commented on code in PR #4917:
URL: https://github.com/apache/arrow-adbc/pull/4917#discussion_r4307560595
##########
csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs:
##########
@@ -424,6 +477,7 @@ private unsafe static AdbcStatusCode
ReleaseDriver(CAdbcDriver* nativeDriver, CA
stub.Dispose();
gch.Free();
nativeDriver->private_data = null;
+ s_idleCollector.DriverReleased();
Review Comment:
This schedules managed code to run after `ReleaseDriver` returns, but
`CAdbcDriverImporter.Load(file, canUnload: true)` frees the native library
immediately after that callback returns (`CAdbcDriverImporter.cs:307-319`). If
the caller unloads such an AOT driver while this delay is pending, the
continuation still targets `CollectIfIdle`/`CollectGarbage` in the unloaded
library and can crash the process. Keep the module alive until pending work
completes, or make the exporter avoid scheduling post-release code for
unloadable drivers (the fix will need coordination with the importer/ABI).
--
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]