From: janw Date: Tue, 1 Apr 2008 06:15:44 +0000 (+0000) Subject: Added Debug code for concurrent DB access problems. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=59cd693c2b308a0ee75c94d6e292fe24349c3c07;p=gosa.git Added Debug code for concurrent DB access problems. Lock files already get removed when creating DB. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10097 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 893ccfb36..e18617b87 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -2125,39 +2125,32 @@ if ($no_bus > 0) { } # connect to gosa-si job queue -unlink($job_queue_file_name.".si.lock"); $job_db = GOSA::DBsqlite->new($job_queue_file_name); $job_db->create_table($job_queue_tn, \@job_queue_col_names); # connect to known_clients_db -unlink($known_clients_file_name.".si.lock"); $known_clients_db = GOSA::DBsqlite->new($known_clients_file_name); $known_clients_db->create_table($known_clients_tn, \@known_clients_col_names); # connect to known_server_db -unlink($known_server_file_name.".si.lock"); $known_server_db = GOSA::DBsqlite->new($known_server_file_name); $known_server_db->create_table($known_server_tn, \@known_server_col_names); # connect to login_usr_db -unlink($login_users_file_name.".si.lock"); $login_users_db = GOSA::DBsqlite->new($login_users_file_name); $login_users_db->create_table($login_users_tn, \@login_users_col_names); # connect to fai_server_db and fai_release_db -unlink($fai_server_file_name.".si.lock"); $fai_server_db = GOSA::DBsqlite->new($fai_server_file_name); $fai_server_db->create_table($fai_server_tn, \@fai_server_col_names); $fai_server_db->create_table($fai_release_tn, \@fai_release_col_names); # connect to packages_list_db -unlink($packages_list_file_name.".si.lock"); unlink($packages_list_file_name); $packages_list_db = GOSA::DBsqlite->new($packages_list_file_name); $packages_list_db->create_table($packages_list_tn, \@packages_list_col_names); # connect to messaging_db -unlink($messaging_file_name.".si.lock"); $messaging_db = GOSA::DBsqlite->new($messaging_file_name); $messaging_db->create_table($messaging_tn, \@messaging_col_names); diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 06f2d0e0e..8d5ff4705 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -19,6 +19,7 @@ sub new { my $lock = $db_name.".si.lock"; # delete existing lock - instance should be running only once if(stat($lock)) { + &main::daemon_log("DEBUG: Removed existing lock $lock.", 7); unlink($lock); } my $self = {dbh=>undef,db_name=>undef,db_lock=>undef,db_lock_handle=>undef}; @@ -36,9 +37,13 @@ sub lock_exists : locked { my $funcname=shift; my $lock = $self->{db_lock}; my $result=(-f $lock); + my $i=0; if($result) { - #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found", 8); + if($i>10) { + &main::daemon_log("WARNING: (".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found. Waiting time: ".($i*500)." us", 8); + } usleep 500; + $i++; } return $result; }