Closed Bug 1598325 Opened 6 years ago Closed 6 years ago

TypeError: ">=" not supported between instances of NoneType and datetime

Categories

(Location :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: willkg)

Details

Attachments

(2 external files)

I was testing new prod today and hit this:

TypeError: '>=' not supported between instances of 'NoneType' and 'datetime.date'
  File "ichnaea/log.py", line 168, in log_tween
    response = handler(request)
  File "ichnaea/db.py", line 102, in db_tween
    response = handler(request)
  File "pyramid/router.py", line 148, in handle_request
    registry, request, context, context_iface, view_name
  File "pyramid/view.py", line 667, in _call_view
    response = view_callable(context, request)
  File "pyramid/config/views.py", line 169, in __call__
    return view(context, request)
  File "pyramid/config/views.py", line 188, in attr_view
    return view(context, request)
  File "pyramid/config/views.py", line 214, in predicate_wrapper
    return view(context, request)
  File "pyramid/viewderivers.py", line 436, in rendered_view
    result = view(context, request)
  File "pyramid/viewderivers.py", line 114, in _class_requestonly_view
    response = inst()
  File "ichnaea/api/views.py", line 154, in __call__
    return self.view(api_key)
  File "ichnaea/api/locate/views.py", line 43, in view
    result = self.locate(api_key)
  File "ichnaea/api/locate/views.py", line 34, in locate
    return searcher.search(query)
  File "ichnaea/api/locate/searcher.py", line 127, in search
    result = self._search(query)
  File "ichnaea/api/locate/searcher.py", line 104, in _search
    results.add(source.search(query))
  File "ichnaea/api/locate/internal.py", line 90, in search
    results = super(InternalPositionSource, self).search(query)
  File "ichnaea/api/locate/internal.py", line 38, in search
    results.add(search(query))
  File "ichnaea/api/locate/cell.py", line 281, in search_cell
    for cluster in cluster_cells(cells, query.cell):
  File "ichnaea/api/locate/cell.py", line 85, in cluster_cells
    for cell in area_cells
  File "ichnaea/api/locate/cell.py", line 85, in <listcomp>
    for cell in area_cells

With this curl:

#!/bin/bash

HOST=https://location.prod.mozaws.net

curl -v -X POST ${HOST}/v1/geolocate?key=test -d '
{
    "considerIp": false,
    "cellTowers": [{
        "radioType": "wcdma",
        "mobileCountryCode": 310,
        "mobileNetworkCode": 410,
        "locationAreaCode": 6982,
        "cellId": 132480271,
        "signalStrength": -60
    }]
}
'

In this case, I'm pretty sure the station for that cell id has a last_seen of None and then the comparison fails.

Sentry issue: https://sentry.prod.mozaws.net/operations/location-prod/issues/6709610/

I think we want to fix this, but after we migrate the infrastructure. It causes geolocate queries to get back an HTTP 500.

Priority: -- → P2

Seeing this in prod now that we've shifted over:

https://sentry.prod.mozaws.net/operations/location-prod/issues/6742070/

Grabbing this to do a quick fix.

Assignee: nobody → willkg
Status: NEW → ASSIGNED

willkg merged PR #1002: "bug 1598325: fix None comparison error" in a7de5c9.

That should make the TypeError go away. I don't know if it gets the right value, though. On Monday, John can verify it--pretty sure he knows more about what that code is doing.

The first fix was deployed to stage and prod and the number of TypeErrors dropped off radically. I was still seeing some errors:

https://sentry.prod.mozaws.net/operations/location-prod/issues/6742094/

I found another comparison that I missed in the first pass. PR 1003 fixes that.

There aren't any more instances of this issue and John double-checked the fixes. We're good here! Marking as FIXED.

Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: