[Koha-devel] log about z3950

Sullivan,Deric [CMC] Deric.Sullivan at ec.gc.ca
Fri Feb 27 08:52:14 CET 2004


Hi,

	I think there is an important difference between using the
InactiveDestroy and opening a new handler in the forked process.  Opening
the new handler is similar to using C4::Context->new_dbh.  Either way, the
original handler was opened before the fork.  So even if the child (forked)
process does not use the original handler, it still has a reference to it
which it inherited from the parent.  So when the child process terminates,
the system will close the original database connection.  InactiveDestroy
tells the system not to clean up (close) this database connection.  You can
still use the original connection in the child process even if you use
InactiveDestroy (just don't close the database connection explicitly).
Another way to do it would be to have the parent process open a new database
connection after it forks a child, but it would have to do this for each
child it forked.

	On my system, a "man DBI" and a search for "InactiveDestroy" gives
some good information on this.

	Ben might want to try and go back to processz3950queue 1.10.2.3 and
make the changes I suggested in the last email.

Deric

-----Original Message-----
From: paul POULAIN [mailto:paul.poulain at free.fr] 
Sent: 27 February, 2004 03:55
To: Benedykt P. Barszcz
Cc: 'koha-devel at lists.sourceforge.net'
Subject: Re: [Koha-devel] log about z3950


Benedykt P. Barszcz wrote:

W liście z czw, 26-02-2004, godz. 23:22, Sullivan,Deric [CMC] pisze: 
  
 Replace:
 my $dbi = C4::Context->dbh;
 with:
 $dbh->{"InactiveDestroy"} = "true";
 
 Replace all references to dbi with dbh.
    
I think that Paul has removed this instance of my $dbi = C4:: ...
Instead there's this:
my $dbi = DBI->connect("DBI:$db_driver:$db_name:$db_host",$db_user, ...

Since I am not a perl guru, could anyone enlighten me what to do?
  
The idea is :
* the DB handler, when the process is forked, is forked too. So, 2 process
use the same DB, and one can close the connection that the other tries to
use.
so, the solution is to have a specific handler for every process.
My modif should do the same thing as the InactiveDestroy one : it opens a
new handler.

Let's try it again. If it does not work, i'll modify the processz3950queue
to avoid forks. the limit here is that searches on various z3950servers will
no more be asynchronous. So i would use a parameter to decide how many forks
we accept.
But I hope my "hard coded opening of dbh" will work.

-- 
Paul POULAIN
Consultant indépendant en logiciels libres
responsable francophone de koha (SIGB libre http://www.koha-fr.org)




More information about the Koha-devel mailing list