maxmind / GeoIP2-perl

Perl API for MaxMind's GeoIP2 web services and databases
https://metacpan.org/release/GeoIP2/
Other
18 stars 11 forks source link

ASN Lite database errors for IP 209.68.160.241 #54

Closed erempel closed 6 years ago

erempel commented 6 years ago

attempting to my $GeoASN = GeoIP2::Database::Reader->new( file => "GeoLite2-ASN.mmdb", locales => [ 'en' ] ); $asn = $GeoASN->asn( ip => "209.68.160.241" );

results in an error of

isa check for "stack_trace_class" failed: stack_trace_class must be a class that responds to ->new at (eval 40) line 71.

and the perl error $! is "No such file or directory".

I have checked the md5 on the Lite database. Most other lookups are fine. I am NOT using the XS module.

Not sure where to turn from here. Is there a mailing list to discuss this stuff prior to submitting a bug?

horgh commented 6 years ago

The IP you mention is not in the current database. As a result, we get an error about it.

The problem appears to be that the stack trace included with the error isn't able to be built, so the output is unhelpful.

Are you able to tell me your version of these distributions?

erempel commented 6 years ago

GeoIP2 - 2.003005 Throwable::Error - 0.200013 Devel::StackTrace - no installed on my production host, but 2.02 is available.

horgh commented 6 years ago

I see. The lack of Devel::StackTrace may be the problem. It's a dependency of Throwable::Error. Could you try installing that please?

erempel commented 6 years ago

Hmmm. Building the RPM for Throwable did not catch this as a dependency.

use GeoIP2::Database::Reader; my $GeoASN = GeoIP2::Database::Reader->new( file => "GeoLite2-ASN.mmdb", locales => [ 'en' ] ); $asn = $GeoASN->asn( ip => "209.68.160.241" );

No record found for IP address 209.68.160.241

Trace begun at /usr/local/share/perl5/GeoIP2/Database/Reader.pm line 89 GeoIP2::Database::Reader::_model_for_address('GeoIP2::Database::Reader=HASH(0x3611670)', 'ASN', 'type_check', 'Regexp=SCALAR(0x2607308)', 'is_flat', 1, 'ip', 209.68.160.241) called at /usr/local/share/perl5/GeoIP2/Database/Reader.pm line 114 GeoIP2::Database::Reader::asn('GeoIP2::Database::Reader=HASH(0x3611670)', 'ip', 209.68.160.241) called at - line 6

horgh commented 6 years ago

Interesting. I'm not sure why that would be. Well I'm glad it's figured out!

erempel commented 6 years ago

This still throws a stack trace and dies. Is there a way to stop that behavior? It would be nice if is just returned an undef. Otherwise I need to wrap all of they call in an eval.

horgh commented 6 years ago

There is no way to change that currently. It's by design. Here's a section showing a few thrown errors. You can see exceptions can happen for a number of reasons.

Try::Tiny is a module that makes working with exceptions reasonably nice if you want to avoid eval.