Programming with Apache::DBI and firebird. Get Stucked httpd on exception

痞子三分冷 提交于 2019-12-12 02:28:45

问题


I have an issues on Web application programming with Firebird.

I'm using mod_perl and Apache::DBI with Firebird. And also using CGI::Session for session handling. CGI::Session uses an already connected $dbh with Firebird.

AutoCommit is ON. Every(multiple) sql execution is wrapped by eval {} statement. for example,

$dbh = DBI->connect("dbi:Firebird:db=$DBSERVER:/home/cdbs/xxnet.fdb;
ib_charset=UTF8;ib_dialect=3",$DBUSER,$DBPASS,{
    AutoCommit=>1,
    LongReadLen=>8192,
    RaiseError=>1
});
eval { $dbh->begin_work()

  my $sql = "SELECT * FROM SAMPLETABLE"
  my $st = $dbh->prepare($sql);
  $st->execute();
  while (my $R = $st->fetchrow_hashref()) {
   ...
  }
  $st->finish();
}; warn $@ if $@;
if ($@) {
  $dbh->rollback();
}else{
  $dbh->commit();
}

When an exception was raised in eval section, execute warn statement and try to rollback transaction. Error messages are logged in error_log,after that, $dbh is going to get stuck -- CGI::Session returns no data. I thought 'warn' statement includes 'rollback', so I tried to comment out $dbh->rollback() statement. It looks good.

Other ways, I use 'warn' to log debug message -- like print STDERR $@. httpd is going to get stuck like as above.

With Oracle(DBD::Oracle), I didn't see these situation.

Please tell me which part is BAD for using transaction with firebird ? warn ? DBD::Firebird ?

Thanks.

Yasuto,

来源:https://stackoverflow.com/questions/42981824/programming-with-apachedbi-and-firebird-get-stucked-httpd-on-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!