Subject: | Bug in DBIx::HA |
Date: | Fri, 25 Aug 2017 17:03:55 +0200 |
To: | bug-DBIx-HA [...] rt.cpan.org |
From: | Filip Rembiałkowski <filip [...] brandify.com> |
We are using DBIx-HA-1.1.tar.gz which has $DBIx::HA::VERSION = 1.10;
DBIx/HA.pm has this
L83 # create an easy reverse-lookup table for finding the db
server name from the dsn
L84 $DBIx::HA::finddbserver{$dsn} = $dbname;
The hash %DBIx::HA::finddbserver is indexed by DSN, while $DATABASE::conf
is indexed by name. This effects in overwriting reverse lookup table, for
the DSN which was already seen, with a different (random) name from keys
%DATABASE::conf.
The attached script will fail randomly, depending on internal hash order
(which is randomized in all recent versions of Perl)
We have no patch, but the whole reverse lookup logic has to be changed.
Example results:
filip@szary:~$ while true; do perl dbixhabug.pl ; done
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
[8458] DBIx::HA:st: *** EXECUTION TIMED OUT in dbi:Pg: ; SQL:
SELECT current_database(), version(), pg_sleep(2) at
/usr/local/share/perl/5.22.1/DBIx/HA.pm line 549.
DBD::Pg::st fetchrow_array failed: no statement executing at dbixhabug.pl
line 40.
DBD::Pg::st fetchrow_array failed: no statement executing at dbixhabug.pl
line 40.
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
[8460] DBIx::HA:st: *** EXECUTION TIMED OUT in dbi:Pg: ; SQL:
SELECT current_database(), version(), pg_sleep(2) at
/usr/local/share/perl/5.22.1/DBIx/HA.pm line 549.
DBD::Pg::st fetchrow_array failed: no statement executing at dbixhabug.pl
line 40.
DBD::Pg::st fetchrow_array failed: no statement executing at dbixhabug.pl
line 40.
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
ROW: filip PostgreSQL 9.6.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
ROW: filip PostgreSQL 9.6.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
ROW: filip PostgreSQL 9.6.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
ROW: filip PostgreSQL 9.6.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
TEST SQL: SELECT current_database(), version(), pg_sleep(2)
Tested on 2 Linux platforms, they had also different DBI & DBD::Pg versions:
1)
This is perl 5, version 18, subversion 2 (v5.18.2) built for
x86_64-linux-thread-multi
openSUSE Leap 42.1 (x86_64)
Linux 4.1.39-56-default #1 SMP PREEMPT
2)
This is perl 5, version 22, subversion 1 (v5.22.1) built for
x86_64-linux-gnu-thread-multi
Ubuntu 16.04.3 LTS
Linux 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64
x86_64 x86_64 GNU/Linux
--
Filip Rembiałkowski
PostgreSQL DBA
[image: Where 2 Get It Logo]
Message body is not shown because sender requested not to inline it.