CurtHagenlocher commented on code in PR #4917:
URL: https://github.com/apache/arrow-adbc/pull/4917#discussion_r4307630723


##########
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:
   The premise is right, but this only affects hosts that already do something 
unsupported, so I've documented it rather than changed the behavior (55ff58d9a).
   
   - Unloading is opt-in: `canUnload` defaults to `false`. The C/C++ driver 
manager never unloads drivers; `ManagedLibrary::Release()` is intentionally 
empty (#204), and the Go driver manager shares that code.
   - A NativeAOT library can't be safely unloaded regardless; Microsoft's 
documentation says unloading isn't supported. Its runtime's finalizer thread 
starts with the library and parks inside it, so a host that unloads an AOT 
driver is already relying on that thread never waking.
   - Cancelling the timer when the driver is released wouldn't make unloading 
safe, because the runtime's timer thread can still wake at its previous due 
time.
   
   `IdleCollectionDelay`'s remarks now say that a pending collection runs after 
release returns, and that a driver which expects to be unloaded should set the 
delay to `null`. The importer's `canUnload` parameter now notes that NativeAOT 
drivers can't be safely unloaded.



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

Reply via email to