Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 102166
Status: patched
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: mmcgillis [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.082810
Fixed in: (no value)



Subject: Error output when using SQL Sever through ODBC
Running Linux RHEL7, freetds 0.91, odbc 3.52.7, perl v5.16.3 Database: create table test1 ( test1Id int identity primary key, name varchar(40) not null, ); create table test2 ( date date not null, test1Id int not null, tkey varchar(40) not null, tvalue varchar(40) not null, foreign key (test1Id) references test1 (test1Id) on delete no action on update no action ); DBIx::Class Files: lib/Test/Schema.pm package Test::Schema; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_namespaces; 1; lib/Test/Schema/Result/Test1.pm package Test::Schema::Result::Test1; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/Core/); __PACKAGE__->table('test1'); __PACKAGE__->add_columns( 'test1Id' => {is_auto_increment => 1}, 'name' => {} ); __PACKAGE__->set_primary_key('test1Id'); __PACKAGE__->has_many('daily','Test::Schema::Result::Test2', 'test1Id'); 1; lib/Test/Schema/Result/Test2.pm package Test::Schema::Result::Test2; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/Core/); __PACKAGE__->table('test2'); __PACKAGE__->add_columns( 'date' => {}, 'test1Id' => {}, 'tkey' => {}, 'tvalue' => {} ); __PACKAGE__->set_primary_key('date','test1Id'); __PACKAGE__->belongs_to('test1','Test::Schema::Result::Test1', 'test1Id'); sub test { my $self=shift; print $self->test1->name."\n"; } 1; Test script "test": #!/usr/bin/perl use strict; use warnings; use lib qw(./lib); use Test::Schema; load(); print "will see error output then 'A'\n"; generateserrorsbutworks(); print "will just see 'A'\n"; workswithnoerrors(); sub generateserrorsbutworks { my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, user => $ENV{T_USER}, password => $ENV{T_PASS}}); unless ($x) { die("failed to connect to ".$ENV{T_DSN}.": ".$!); } my $t = $x->resultset('Test1')->find({test1Id=>1}); $t->daily->search({date=>'2015/1/1'})->next->test; } sub workswithnoerrors { my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, user => $ENV{T_USER}, password => $ENV{T_PASS}}); unless ($x) { die("failed to connect to ".$ENV{T_DSN}.": ".$!); } my $t = $x->resultset('Test1')->find({test1Id=>1}); ($t->daily->search({date=>'2015/1/1'}))[0]->test; } sub load { my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, user => $ENV{T_USER}, password => $ENV{T_PASS}}); unless ($x) { die("failed to connect to ".$ENV{T_DSN}.": ".$!); } $x->populate('Test1',[['name'],['A']]); $x->populate('Test2',[['date','test1Id','tkey','tvalue'], ['2015/1/1',1,'X',1], ['2015/1/1',1,'Y',2], ['2015/1/1',1,'Z',3]]); } Output from above script: $ ./test will see error output then 'A' (in cleanup) DBIx::Class::Storage::DBI::_execute(): DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid cursor state (SQL-24000) [state was 24000 now HY000] Unable to fetch information about the error [for Statement "SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? )"] at lib/Test/Schema/Result/Test2.pm line 20 A will just see 'A' A All the above works correctly with no error messages at all when using MySQL.
Subject: Re: [rt.cpan.org #102166] Error output when using SQL Sever through ODBC
Date: Wed, 18 Feb 2015 08:54:43 +0100
To: bug-DBIx-Class [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 02/17/2015 02:14 AM, Matthew McGillis via RT wrote: Show quoted text
> Mon Feb 16 20:14:39 2015: Request 102166 was acted upon. > Transaction: Ticket created by MMCGILLIS > Queue: DBIx-Class > Subject: Error output when using SQL Sever through ODBC > Broken in: 0.082810 > Severity: Normal > Owner: Nobody > Requestors: mmcgillis@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102166 > > > > Running Linux RHEL7, freetds 0.91, odbc 3.52.7, perl v5.16.3
Hi! Thank you for the detailed report (I wish I was getting more of these :) Show quoted text
> > ... > > Output from above script: > $ ./test > will see error output then 'A' > (in cleanup) DBIx::Class::Storage::DBI::_execute(): DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid cursor state (SQL-24000) [state was 24000 now HY000] > Unable to fetch information about the error [for Statement "SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? )"] at lib/Test/Schema/Result/Test2.pm line 20 > A > will just see 'A' > A
Please run the same scrpt with DBIC_TRACE=1 and get me all of that output as well (among other things it will include a stacktrace of where exactly the problem originates) Thanks!
$ ./test BEGIN WORK INSERT INTO test1 ( name) VALUES ( ? ): '__BULK_INSERT__' COMMIT BEGIN WORK INSERT INTO test2 ( date, test1Id, tkey, tvalue) VALUES ( ?, ?, ?, ? ): '__BULK_INSERT__' COMMIT will see error output then 'A' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' (in cleanup) DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid cursor state (SQL-24000) [state was 24000 now HY000] Unable to fetch information about the error [for Statement "SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? )"] at /site/perl/share/perl5/DBIx/Class/Schema.pm line 1077. DBIx::Class::Schema::throw_exception('Test::Schema=HASH(0x2b38b88)', 'DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Se...') called at /site/perl/share/perl5/DBIx/Class/Storage.pm line 112 DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server=HASH(0x...', 'DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Se...') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI.pm line 1470 DBIx::Class::Storage::DBI::__ANON__('DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid cu...', 'DBI::st=HASH(0x303d0c0)', undef) called at /site/perl/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 224 eval {...} called at /site/perl/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 224 eval {...} called at /site/perl/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 224 DBIx::Class::Storage::BlockRunner::__ANON__() called at /site/perl/share/perl5/Context/Preserve.pm line 37 Context::Preserve::preserve_context('CODE(0x378cb30)', 'replace', 'CODE(0x3787810)') called at /site/perl/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 233 DBIx::Class::Storage::BlockRunner::_run('DBIx::Class::Storage::BlockRunner=HASH(0x378c9c8)', 'CODE(0x3777c78)') called at /site/perl/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 125 DBIx::Class::Storage::BlockRunner::run('DBIx::Class::Storage::BlockRunner=HASH(0x378c9c8)', 'CODE(0x3777c78)') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI.pm line 855 DBIx::Class::Storage::DBI::dbh_do(undef, undef, 'SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id =...', 'ARRAY(0x3787b58)', 'ARRAY(0x3693688)') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI.pm line 1813 DBIx::Class::Storage::DBI::_execute('DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server=HASH(0x...', 'select', 'ARRAY(0x3787540)', 'ARRAY(0x375b028)', 'HASH(0x3786fe8)', 'HASH(0x3787798)') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI/MSSQL.pm line 74 DBIx::Class::Storage::DBI::MSSQL::_execute('DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server=HASH(0x...', 'select', 'ARRAY(0x3787540)', 'ARRAY(0x375b028)', 'HASH(0x3786fe8)', 'HASH(0x3787798)') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI.pm line 2387 DBIx::Class::Storage::DBI::_select('DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server=HASH(0x...', 'ARRAY(0x3787540)', 'ARRAY(0x375b028)', 'HASH(0x3786fe8)', 'HASH(0x3787630)') called at /site/perl/share/perl5/DBIx/Class/Storage/DBI.pm line 2564 DBIx::Class::Storage::DBI::select_single('DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server=HASH(0x...', 'ARRAY(0x3787540)', 'ARRAY(0x375b028)', 'HASH(0x3786fe8)', 'HASH(0x3787630)') called at /site/perl/share/perl5/DBIx/Class/ResultSet.pm line 1099 DBIx::Class::ResultSet::single('DBIx::Class::ResultSet=HASH(0x3787198)') called at (eval 148) line 44 Test::Schema::Result::Test2::test1('Test::Schema::Result::Test2=HASH(0x377ed08)') called at lib/Test/Schema/Result/Test2.pm line 20 Test::Schema::Result::Test2::test('Test::Schema::Result::Test2=HASH(0x377ed08)') called at ./test line 24 main::generateserrorsbutworks() called at ./test line 12 SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' A will just see 'A' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' A
Anything else I can provide to move this forward?
On Tue Feb 17 02:14:39 2015, MMCGILLIS wrote: Show quoted text
> Running Linux RHEL7, freetds 0.91, odbc 3.52.7, perl v5.16.3 > > Database: > create table test1 ( > test1Id int identity primary key, > name varchar(40) not null, > ); > create table test2 ( > date date not null, > test1Id int not null, > tkey varchar(40) not null, > tvalue varchar(40) not null, > foreign key (test1Id) references test1 (test1Id) > on delete no action > on update no action > ); > > DBIx::Class Files: > > lib/Test/Schema.pm > package Test::Schema; > > use base qw/DBIx::Class::Schema/; > > __PACKAGE__->load_namespaces; > > 1; > > > lib/Test/Schema/Result/Test1.pm > package Test::Schema::Result::Test1; > > use base qw/DBIx::Class/; > > __PACKAGE__->load_components(qw/Core/); > __PACKAGE__->table('test1'); > __PACKAGE__->add_columns( > 'test1Id' => {is_auto_increment => 1}, > 'name' => {} > ); > __PACKAGE__->set_primary_key('test1Id'); > > __PACKAGE__->has_many('daily','Test::Schema::Result::Test2', > 'test1Id'); > > 1; > > > lib/Test/Schema/Result/Test2.pm > package Test::Schema::Result::Test2; > > use base qw/DBIx::Class/; > > __PACKAGE__->load_components(qw/Core/); > __PACKAGE__->table('test2'); > __PACKAGE__->add_columns( > 'date' => {}, > 'test1Id' => {}, > 'tkey' => {}, > 'tvalue' => {} > ); > __PACKAGE__->set_primary_key('date','test1Id'); > > __PACKAGE__->belongs_to('test1','Test::Schema::Result::Test1', > 'test1Id'); > > sub test { > my $self=shift; > print $self->test1->name."\n"; > } > > 1; > > > Test script "test": > #!/usr/bin/perl > > use strict; > use warnings; > > use lib qw(./lib); > > use Test::Schema; > > load(); > print "will see error output then 'A'\n"; > generateserrorsbutworks(); > print "will just see 'A'\n"; > workswithnoerrors(); > > sub generateserrorsbutworks { > my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, > user => $ENV{T_USER}, > password => $ENV{T_PASS}}); > unless ($x) { > die("failed to connect to ".$ENV{T_DSN}.": ".$!); > } > my $t = $x->resultset('Test1')->find({test1Id=>1}); > $t->daily->search({date=>'2015/1/1'})->next->test; > } > > sub workswithnoerrors { > my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, > user => $ENV{T_USER}, > password => $ENV{T_PASS}}); > unless ($x) { > die("failed to connect to ".$ENV{T_DSN}.": ".$!); > } > my $t = $x->resultset('Test1')->find({test1Id=>1}); > ($t->daily->search({date=>'2015/1/1'}))[0]->test; > } > > sub load { > my $x = Test::Schema->connect({dsn => $ENV{T_DSN}, > user => $ENV{T_USER}, > password => $ENV{T_PASS}}); > unless ($x) { > die("failed to connect to ".$ENV{T_DSN}.": ".$!); > } > > $x->populate('Test1',[['name'],['A']]); > $x->populate('Test2',[['date','test1Id','tkey','tvalue'], > ['2015/1/1',1,'X',1], > ['2015/1/1',1,'Y',2], > ['2015/1/1',1,'Z',3]]); > } > > > Output from above script: > $ ./test > will see error output then 'A' > (in cleanup) DBIx::Class::Storage::DBI::_execute(): DBI > Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid > cursor state (SQL-24000) [state was 24000 now HY000] > Unable to fetch information about the error [for Statement "SELECT > me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? )"] at > lib/Test/Schema/Result/Test2.pm line 20 > A > will just see 'A' > A > > All the above works correctly with no error messages at all when using > MySQL.
Apologies for the long silence. I just got to this ticket, and can not seem to reproduce the failure with neither the current blead nor DBIC 0.082820 (latest on CPAN), with an environment very similar to yours. Do you still have access to this box? I would like you to run some custom diag statements for me if the case. Once again - sorry it took forever.
Show quoted text
> Do you still have access to this box? I would like you to run some > custom diag statements for me if the case.
Yes. The version of DBIx::Class currently being used is 0.082810 that produces the above output. I would have to build the latest to see if changes anything. Let me know how I can help the problem is still reproducible in my setup.
On Wed Feb 10 22:39:00 2016, MMCGILLIS wrote: Show quoted text
> > Let me know how I can help the problem is still reproducible in my > setup.
Ok. Please checkout the 'current/blead' branch from https://github.com/dbsrgits/dbix-class, and run `prove -l t/746mssql.t` setting the necessary envvars (it will tell you which). Let me know if it produces any warnings at all. If it does - rerun it under DBIC_TRACE=1 and send me the relevant log. If it is silent - try to run your test against 'current/blead' - perhaps I inadvertently resolved this problem during the txn handling rework. We'll proceed once I get answers to the above.
Show quoted text
> Ok. Please checkout the 'current/blead' branch from > https://github.com/dbsrgits/dbix-class, and run `prove -l > t/746mssql.t` setting the necessary envvars (it will tell you which). > Let me know if it produces any warnings at all.
Not having much luck building blead. $ perl Makefile.PL include ./dbix-class-current-blead/inc/Module/Install.pm include inc/Module/Install/Makefile.pm include inc/Module/Install/Base.pm include inc/Module/Install/Metadata.pm include inc/Module/Install/Scripts.pm Including all optional deps Failed execution of maint/Makefile.PL.inc/29_handle_version.pl: Tags in unknown format found: v1, v2, v3
You can ignore the above it is my issue I was building your blead inside of some other code that was returning its git label information. Hope to have this build soon.
$ prove -l t/746mssql.t t/746mssql.t .. ok All tests successful. Files=1, Tests=121, 2 wallclock secs ( 0.06 usr 0.02 sys + 1.20 cusr 0.12 csys = 1.40 CPU) Result: PASS $ ./test DBIx::Class Version: 0.082820 will see error output then 'A' (in cleanup) DBIx::Class::Storage::DBI::_execute(): DBI Exception: DBD::ODBC::st DESTROY failed: [FreeTDS][SQL Server]Invalid cursor state (SQL-24000) [state was 24000 now HY000] Unable to fetch information about the error [for Statement "SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? )"] at lib/Test/Schema/Result/Test2.pm line 20 A will just see 'A' A Problem still exists in blead. Let me know what else I can do.
Subject: Re: [rt.cpan.org #102166] Error output when using SQL Sever through ODBC
Date: Thu, 11 Feb 2016 06:04:58 +0100
To: bug-DBIx-Class [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 02/11/2016 01:15 AM, Matthew McGillis via RT wrote: Show quoted text
> $ ./test > DBIx::Class Version: 0.082820
^^ This means you aren't using the git version (it is versioned at 0.082899_...). Please re-run the test using `perl -I lib test` or something similar.
DBIx::Class Version: 0.08289915 will see error output then 'A' DBI::db=HASH(0x1d912b8)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at /export/linux/OCHZIFF/risk_mmcgillis/src/riskdb/bug/perl/dbix-class-current-blead/blib/lib/DBIx/Class/Storage/DBI.pm line 891. A will just see 'A' A
$ DBIC_TRACE=1 ./test DBIx::Class Version: 0.08289915 BEGIN WORK INSERT INTO test1 ( name) VALUES ( ? ): '__BULK_INSERT__' COMMIT BEGIN WORK INSERT INTO test2 ( date, test1Id, tkey, tvalue) VALUES ( ?, ?, ?, ? ): '__BULK_INSERT__' COMMIT will see error output then 'A' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' DBI::db=HASH(0x301ab48)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at /export/linux/OCHZIFF/risk_mmcgillis/src/riskdb/bug/perl/dbix-class-current-blead/blib/lib/DBIx/Class/Storage/DBI.pm line 891. SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' A will just see 'A' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' A
Subject: Re: [rt.cpan.org #102166] Error output when using SQL Sever through ODBC
Date: Thu, 11 Feb 2016 17:01:13 +0100
To: bug-DBIx-Class [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 02/11/2016 10:13 AM, Matthew McGillis via RT wrote: Show quoted text
> Queue: DBIx-Class > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102166 > > > $ DBIC_TRACE=1 ./test > DBIx::Class Version: 0.08289915 > BEGIN WORK > INSERT INTO test1 ( name) VALUES ( ? ): '__BULK_INSERT__' > COMMIT > BEGIN WORK > INSERT INTO test2 ( date, test1Id, tkey, tvalue) VALUES ( ?, ?, ?, ? ): '__BULK_INSERT__' > COMMIT > will see error output then 'A' > SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' > SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' > SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' > DBI::db=HASH(0x301ab48)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at /export/linux/OCHZIFF/risk_mmcgillis/src/riskdb/bug/perl/dbix-class-current-blead/blib/lib/DBIx/Class/Storage/DBI.pm line 891. > SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' > A > will just see 'A' > SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' > SELECT me.date, me.test1Id, me.tkey, me.tvalue FROM test2 me WHERE ( ( date = ? AND me.test1Id = ? ) ): '2015/1/1', '1' > SELECT me.test1Id, me.name FROM test1 me WHERE ( me.test1Id = ? ): '1' > A
Thank you. I will try to reproduce this later today when I have access to a windows again.
On Thu Feb 11 10:12:21 2016, MMCGILLIS wrote: Show quoted text
> DBI::db=HASH(0x1d912b8)->disconnect invalidates 1 active statement > handle (either destroy statement handles or call finish on them before > disconnecting) at > /export/linux/OCHZIFF/risk_mmcgillis/src/riskdb/bug/perl/dbix-class- > current-blead/blib/lib/DBIx/Class/Storage/DBI.pm line 891.
This has *finally* been properly pinned down and fixed in https://github.com/dbsrgits/dbix-class/commit/d3a2e424976. Refer to the commit message for details on the how and why. Sorry for taking so long in addressing this, pesky windows.
I downloaded the latest version of DBIx::Class to see if this was included. Just wondering if anyone could provide an idea about when this fix might get into a release.
Subject: Re: [rt.cpan.org #102166] Error output when using SQL Sever through ODBC
Date: Sun, 7 Aug 2016 04:41:19 +0200
To: bug-DBIx-Class [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 08/05/2016 10:21 PM, Matthew McGillis via RT wrote: Show quoted text
> Queue: DBIx-Class > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102166 > > > I downloaded the latest version of DBIx::Class to see if this was included. Just wondering if anyone could provide an idea about when this fix might get into a release. >
Hello Matthew For current schedule (and subsequent updates) please follow this mailthread: http://lists.scsys.co.uk/pipermail/dbix-class/2016-August/012171.html Sorry it's taking a while, really not long now!