Peter, Of course! They can have the same address even if they are different connections since they have their own address space. Thank for reminding me of that. The likelihood of the same address is probably very high, especially right after the httpd is forked and if the processes execute the same commands.
I'll investigate lsof and netstat more. I'm not yet sure how to read that all and how to see which is associated with which $dbh in the httpd process. But maybe I don't need to. I'll try to make some leaps of faith and see which changes then pass the ab stress tests. If they pass, then maybe I can just assume the processes correctly have different connections. --len -----Original Message----- From: Peter J. Holzer [mailto:h...@wsr.ac.at] Sent: Sunday, May 20, 2012 3:27 AM To: Schultz, Len Cc: dbi-users@perl.org Subject: Re: Creating new database handles with mod_perl On 2012-05-19 20:06:44 -0400, Schultz, Len wrote: > I've run into an issue when stress testing mod_perl that the database > connections are going away. I suspect that processes are sharing > database connections, causing the issue. > > But I've followed all instructions for Apache::DBI, and can't figure > this out. > > I'm making the connections in the child process and not in startup.pl. > But when I examine the $dbh returned by each child from the > DBI->connnect, the address is the same for every httpd process. Firstly, > if this is working properly and reconnecting for each process, should > the address returned by DBI->connect be different for each child > process? No. Each process has its own address space. The same address in two different processes does not (generally) refer to the same memory location. If both processes allocate the handle shortly after the fork it is very likely that both get the same address. To see whether they are using the same connection, you should use lsof (or netstat) to look at the TCP connections (I assume you are using the TCP driver and not the bequeath driver): The tuple (local address, local port, remote address, remote port) is unique for each connection. hp -- _ | Peter J. Holzer | Auf jedem Computer sollte der Satz Ludwigs II |_|_) | Sysadmin WSR | eingeprägt stehen: "Ein ewig Rätsel will ich | | | h...@wsr.ac.at | bleiben, mir und andern." __/ | http://www.hjp.at/ | -- Wolfram Heinrich in desd