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
signature.asc
Description: Digital signature