Re: Are NIF resources meant to be destroyed immediately on GC?

Stanislaw Klekot <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
On Wed, Nov 25, 2020 at 11:35:43AM +0100, Sean Hinde wrote:
> I agree. My use case for this was building a nif for the oracle oci bindings.
> 
> In the happy path users should call the provided db_close function which would flush outstanding transactions and close everything down in the dirty nif.
> 
> The problematic case is where the user's process holding the connection crashes. In that case we need the finaliser as the "secondary" resource reclamation path. If that path cannot safely close the db handle for fear of screwing up the emulator it's a problem.
> 
> The solution today is to have an interim process to fault isolate the nif holding process from the user process. Which adds overhead.

Uhm... But this is exactly what ports are supposed to handle and it's
exactly how they work. Why shoehorning NIFs here?

-- 
Stanislaw Klekot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.