oracle / odpi

ODPI-C: Oracle Database Programming Interface for Drivers and Applications
https://oracle.github.io/odpi/
Other
264 stars 75 forks source link

Child process inherits connection fds #152

Closed tgulacsi closed 3 years ago

tgulacsi commented 3 years ago

In a program I've forgot to close the ODPI connection at the end of the program. The program started a daemon, and that daemon inherited the oracle connections (opened file descriptors). These are seen in CLOSE_WAIT state at client host, and alive sessions on the server.

Go marks the file descriptors before fork-exec as close-on-exec. Can OCI/ODPI do the same?

anthony-tuininga commented 3 years ago

@tgulacsi, I discussed this internally and the conclusion was that there is no way to do this currently. You would need to iterate through the file descriptors and simply close them yourself in the child process prior to calling exec(). Or simply not forget to close the connections in the normal fashion, of course!

tgulacsi commented 3 years ago

Thanks! That's what I thought, too. But worth a try.