I'm writing a UNIX daemon which is used by clients to retrieve some data from an Oracle database.The daemon uses the module
Net::Server, and of course uses DBI to connect to Oracle.
My question is about the connection to Oracle. I want to connect to Oracle only once (of course), so in the initialization phase I create a database handler.
When a client makes a request to the daemon, a new child is forked (OK I can use Net::Server::PreFork to have a pre-forked pool of children). The child actually executes the query and save somewhere in the file system the results for the client.
This architecture implies that the database handler is shared among all forked children. Is this a problem?
I've noticed that if a child dies (for example because it encounters some problem while saving data for the client) the daemon loses the connection to Oracle. I've read DBI man page and found that there is an attribute for DBI handlers called InactiveDestroy which "It is specifically designed for use in UNIX applications which 'fork' child processes.". Does anyone have any experience with problems of this kind?
Thank you very much.
marcos