elixir-geolix/geolix

Incorrect results for some IP addresses

Closed this issue · 3 comments

The IP address 69.180.1.1 returns incorrect data:

iex> Geolix.lookup("69.180.1.1").city.city.names.en
"Houston"

Using the MaxMindDB Ruby gem yields the correct result (as confirmed by the MaxMind web service):

> db.lookup('69.180.1.1').city.name
 => "Cartersville" 

Both are using the same GeoLite2-City.mmdb database, so this seems to be some kind of parsing bug.

Possibly related:

iex> Geolix.lookup "212.58.244.20"
** (exit) exited in: GenServer.call(#PID<0.157.0>, {:lookup, {212, 58, 244, 20}}, 5000)
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: " La G"
            (geolix) lib/geolix/decoder.ex:127: Geolix.Decoder.decode_double/3
            (geolix) lib/geolix/decoder.ex:75: Geolix.Decoder.decode_by_type/4
            (geolix) lib/geolix/decoder.ex:142: Geolix.Decoder.decode_map/4
            (geolix) lib/geolix/database.ex:55: Geolix.Database.lookup_pointer/3
            (geolix) lib/geolix/database.ex:48: Geolix.Database.lookup/4
            (geolix) lib/geolix/database.ex:25: Geolix.Database.lookup_all/3
            (geolix) lib/geolix/server/worker.ex:17: Geolix.Server.Worker.handle_call/3
            (stdlib) gen_server.erl:580: :gen_server.handle_msg/5
16:42:24.950 [error] GenServer #PID<0.157.0> terminating
Last message: {:lookup, {212, 58, 244, 20}}
State: []

I will look into that. Having some misbehaving IPs should make it quite easy.

Both the IPs you provided should now return a proper result with "Cartersville" for "69.180.1.1" and "Tadworth" for "212.58.244.20" (in sync with the ruby gem).

During the next days I will setup some sort of large-scale integration testing comparing the results of like some dozen (random) results from Geolix and the ruby gem and/or one of the official libraries. Any other lurking errors in the parser should be visible then.

If there are any other errors you notice please do not hesitate to open another issue.