I've tried posting this to the perl-mysql mailing list but that list doesn't seem to have any traffic, so I'm hoping maybe someone on this list has some experience with Apache::Session::MySQL.
Does anyone know if a call to untie on a tied hash to Apache::Session::MySQL will close the database connection? I'm thinking it should, but if I do something like the following in a loop, after about 10,000 iterations, my database becomes unresponsive and the calls to tie in the loop fail with a can't connect to db error. I have to think the reason being that there are no further connections available. I understand I can also pass an already open $dbh which I have more control over and would be more efficient for this example, but I am wondering about the untie and closing db handles for other purposes. This seems pretty basic and if the database handles are being closed by untie then my database should remain normal and responsive through the looping, but it is not. code snippet: for ($i=0; $i<@session_id_array; $i++) { %session_hash = (); $session_id = $session_id_array[$i]; eval { tie %session_hash, 'Apache::Session::MySQL', $session_id, { DataSource => $data_source, UserName => 'user', Password => 'password', LockDataSource => $data_source, LockUserName => 'user', LockPassword => 'password', TableName => 'session_table' }; }; if ($@) { # After about 10,000 loop iterations, the tie fails with db connection error print("Session retrieval failed: $@\n"); } else { print("Retrieval OK.\n"); } untie(%session_hash); }