Skip Menu |

This queue is for tickets about the WWW-Gazetteer-HeavensAbove CPAN distribution.

Report information
The Basics
Id: 42709
Status: resolved
Priority: 0/
Queue: WWW-Gazetteer-HeavensAbove

People
Owner: Nobody in particular
Requestors: henry.ayoola [...] googlemail.com
Cc:
AdminCc:

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



Subject: Infinite loop
Date: Fri, 23 Jan 2009 11:21:24 +0100
To: bug-WWW-Gazetteer-HeavensAbove [...] rt.cpan.org
From: Henry Ayoola <henry.ayoola [...] googlemail.com>
I noticed that a certain query with Gazetteer-HeavensAbove seemed to be taking rather a long time, and then I discovered that it was spinning through the same cities again and again. The code for splitting up a large query into multiple ones seems to have a problem with the ß character. Here's a test case. Forgive me if the style isn't very idiomatic - Perl is at best my third language. #!/usr/bin/perl use WWW::Gazetteer::HeavensAbove; my $atlas = WWW::Gazetteer::HeavensAbove->new; my %seenmap; my $cb = sub { local $, = "\t"; local $\ = $/; local $line; foreach $foo (@_) { $line = join(':', @$foo{qw(name latitude longitude)}); die "Seen '$line' twice" if $seenmap{$line} > 1; warn "Seen '$line' once" if $seenmap{$line} > 0; $seenmap{$line}++; } }; # Demo of it not breaking. A single city is seen twice. $atlas->find('A*', 'DE', $cb); # Demo of it breaking. A lot of cities are seen twice, and then it loops again. $atlas->find('Gro*', 'DE', $cb); # End test case Version information: Version 0.16 of WWW::Gazetteer::HeavensAbove (downloaded directly from CPAN) Perl version 5.10.0 built for i486-linux-gnu-thread-multi (dpkg reports 5.10.0-16) Linux 2.6.26-1-686 #1 SMP i686 GNU/Linux Debian lenny dpkg reports libwww-perl (LWP) as version 5.813-1 I'm executing the test script from GNU bash version 3.2.39(1)-release (i486-pc-linux-gnu) with locale es_ES.UTF-8 Hope that's enough info for you to reproduce it. Yours, Henry Ayoola
Subject: Re: [rt.cpan.org #42709] Infinite loop
Date: Fri, 23 Jan 2009 11:56:53 +0100
To: Henry Ayoola via RT <bug-WWW-Gazetteer-HeavensAbove [...] rt.cpan.org>
From: "Philippe Bruhat (BooK)" <philippe.bruhat [...] free.fr>
On Fri, Jan 23, 2009 at 05:22:37AM -0500, Henry Ayoola via RT wrote: Show quoted text
> > I noticed that a certain query with Gazetteer-HeavensAbove seemed to be > taking rather a long time, and then I discovered that it was spinning > through the same cities again and again. The code for splitting up a large > query into multiple ones seems to have a problem with the ß character. > Here's a test case. Forgive me if the style isn't very idiomatic - Perl is > at best my third language.
Thank you very much for providing the test case! I'll look at this and try to fix it. I'm happy to find out someone is actually using this module. :-) -- Philippe Bruhat (BooK) The friends we make and the friends we lose are all better than the friends who want to make us lose. (Moral from Groo The Wanderer #1 (Pacific))
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #42709] Infinite loop
Date: Thu, 29 Jan 2009 01:27:29 +0100
To: Henry Ayoola via RT <bug-WWW-Gazetteer-HeavensAbove [...] rt.cpan.org>
From: "Philippe Bruhat (BooK)" <philippe.bruhat [...] free.fr>
On Fri, Jan 23, 2009 at 05:22:37AM -0500, Henry Ayoola via RT wrote: Show quoted text
> > I noticed that a certain query with Gazetteer-HeavensAbove seemed to be > taking rather a long time, and then I discovered that it was spinning > through the same cities again and again. The code for splitting up a large > query into multiple ones seems to have a problem with the ß character. > Here's a test case. Forgive me if the style isn't very idiomatic - Perl is > at best my third language. > > # Demo of it not breaking. A single city is seen twice. > $atlas->find('A*', 'DE', $cb);
Actually, this is an issue with the heavens-above.com database. Looking for 'Auwallenburg' returns two lines. If you add the alias to the $line string, it will not warn, because the two records are actually a little different: Auwallenburg:50.783:10.417: Auwallenburg:50.783:10.417:Trusetal Show quoted text
> # Demo of it breaking. A lot of cities are seen twice, and then it loops again. > $atlas->find('Gro*', 'DE', $cb);
This is indeed an issue with ß. My code didn't know it should move on to letter 't' when it was done with it. I've used your example script to write a test script, and this bug is fixed in version 0.17, which should appear on CPAN soon. Many thanks for your report! -- Philippe Bruhat (BooK) All of life is a series of trades. And the more you exchange, the less you have to show for it. (Moral from Groo The Wanderer #4 (Pacific))