Skip Menu |

This queue is for tickets about the Net-MySQL CPAN distribution.

Report information
The Basics
Id: 21508
Status: open
Priority: 0/
Queue: Net-MySQL

People
Owner: Nobody in particular
Requestors: krisodb [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: If query returns no data, Net::MySQL hangs
Version 0.09. If you execute a query, and no data is returned, the script keeps waiting for input. Example: table with 4 columns, the first one is autoincrementing. Of you do then: SELECT * FROM table WHERE name1=a AND name2=b you will get a first answer, the column names. The Net::MySQL goes checking for further input but, there is no input ... So it keeps waiting. Try it on an empty table ...
From: krisodb [...] gmail.com
It only seems to happen on an empty table. Once populated, an empty result doesn't cause the blocking effect ... On Vr. Sep. 15 03:25:49 2006, kob wrote: Show quoted text
> Version 0.09. > If you execute a query, and no data is returned, the script keeps > waiting for input. > Example: > table with 4 columns, the first one is autoincrementing. > Of you do then: > SELECT * FROM table WHERE name1=a AND name2=b > you will get a first answer, the column names. > The Net::MySQL goes checking for further input but, there is no input ... > So it keeps waiting. > Try it on an empty table ...
From: krisodb [...] gmail.com
sub _has_next_packet { my $self = shift; #substr($_[0], -1) ne "\xfe"; return substr($_[0], -5) ne "\xfe\0\0\x22\x00"; } The problem is here. Incase the database is empty or has 1 record, the return value will be \xfe\0\0\x02\x00 On Vr. Sep. 15 03:44:29 2006, kob wrote: Show quoted text
> It only seems to happen on an empty table. Once populated, an empty > result doesn't cause the blocking effect ... > > On Vr. Sep. 15 03:25:49 2006, kob wrote:
> > Version 0.09. > > If you execute a query, and no data is returned, the script keeps > > waiting for input. > > Example: > > table with 4 columns, the first one is autoincrementing. > > Of you do then: > > SELECT * FROM table WHERE name1=a AND name2=b > > you will get a first answer, the column names. > > The Net::MySQL goes checking for further input but, there is no
input ... Show quoted text
> > So it keeps waiting. > > Try it on an empty table ...
> >
From: joe.hudson [...] gmail.com
Indeed. So the obvious solution is to change the funtion 'sub _has_next_packet' in MySQL.pm to this: sub _has_next_packet { my $self = shift; return substr($_[0], -5) !~ qr/(\xfe\0\0\x22\x00|\xfe\0\0\x02\x00)/; } and then reinstall :) It would be nice to find a mysql doc with what all the end codes actually mean, so we can be 100% sure this is a safe fix..., but I've tried the above on my database and it works beautifully :) On Fri Sep 15 04:31:01 2006, kob wrote: Show quoted text
> sub _has_next_packet > { > my $self = shift; > #substr($_[0], -1) ne "\xfe"; > return substr($_[0], -5) ne "\xfe\0\0\x22\x00"; > } > > The problem is here. Incase the database is empty or has 1 record, the > return value will be \xfe\0\0\x02\x00 > > On Vr. Sep. 15 03:44:29 2006, kob wrote:
> > It only seems to happen on an empty table. Once populated, an empty > > result doesn't cause the blocking effect ... > > > > On Vr. Sep. 15 03:25:49 2006, kob wrote:
> > > Version 0.09. > > > If you execute a query, and no data is returned, the script keeps > > > waiting for input. > > > Example: > > > table with 4 columns, the first one is autoincrementing. > > > Of you do then: > > > SELECT * FROM table WHERE name1=a AND name2=b > > > you will get a first answer, the column names. > > > The Net::MySQL goes checking for further input but, there is no
> input ...
> > > So it keeps waiting. > > > Try it on an empty table ...
> > > >
> >
From: e.pwei84 [...] gmail.com
According to http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#EOF_Packet, The real byte that the subroutine should care about is the 5th from the end. This is probably what you really want: sub _has_next_packet { my $self = shift; return substr($_[0], -5, 1) ne "\xfe"; } On Sun Dec 03 21:40:52 2006, oddmedley wrote: Show quoted text
> Indeed. So the obvious solution is to change the funtion 'sub > _has_next_packet' in MySQL.pm to this: > > sub _has_next_packet > { > my $self = shift; > return substr($_[0], -5) !~ qr/(\xfe\0\0\x22\x00|\xfe\0\0\x02\x00)/; > } > > and then reinstall :) > > It would be nice to find a mysql doc with what all the end codes > actually mean, so we can be 100% sure this is a safe fix..., but I've > tried the above on my database and it works beautifully :) > > > On Fri Sep 15 04:31:01 2006, kob wrote:
> > sub _has_next_packet > > { > > my $self = shift; > > #substr($_[0], -1) ne "\xfe"; > > return substr($_[0], -5) ne "\xfe\0\0\x22\x00"; > > } > > > > The problem is here. Incase the database is empty or has 1 record, the > > return value will be \xfe\0\0\x02\x00 > > > > On Vr. Sep. 15 03:44:29 2006, kob wrote:
> > > It only seems to happen on an empty table. Once populated, an empty > > > result doesn't cause the blocking effect ... > > > > > > On Vr. Sep. 15 03:25:49 2006, kob wrote:
> > > > Version 0.09. > > > > If you execute a query, and no data is returned, the script keeps > > > > waiting for input. > > > > Example: > > > > table with 4 columns, the first one is autoincrementing. > > > > Of you do then: > > > > SELECT * FROM table WHERE name1=a AND name2=b > > > > you will get a first answer, the column names. > > > > The Net::MySQL goes checking for further input but, there is no
> > input ...
> > > > So it keeps waiting. > > > > Try it on an empty table ...
> > > > > >
> > > >
> >