telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://fiware-orion.rtfd.io/
GNU Affero General Public License v3.0
212 stars 264 forks source link

Overlogging as ERROR a situation that isn't #3375

Closed fgalan closed 5 years ago

fgalan commented 5 years ago

Registration is created (using the same example as in the API walkthrough):

curl -v localhost:1026/v2/registrations -s -S -H 'Content-Type: application/json' -d @-  <<EOF
{
  "description": "Registration for Room5",
  "dataProvided": {
    "entities": [
      {
        "id": "Room5",
        "type": "Room"
      }
    ],
    "attrs": [
      "temperature",
      "pressure"
    ]
  },
  "provider": {
    "http": {
      "url": "http://mysensors.com/Rooms"
    },
    "legacyForwarding": true
  }
}
EOF

Then get the registration:

$ curl -s -S localhost:1026/v2/registrations | python -mjson.tool

[
    {
        "dataProvided": {
            "attrs": [
                "temperature",
                "pressure"
            ],
            "entities": [
                {
                    "id": "Room5",
                    "type": "Room"
                }
            ]
        },
        "description": "Registration for Room5",
        "id": "5c0fb586bee3354142934c09",
        "provider": {
            "http": {
                "url": "http://mysensors.com/Rooms"
            },
            "legacyForwarding": true,
            "supportedForwardingMode": "all"
        },
        "status": "active"
    }
]

The following error appears in log:

time=Tuesday 11 Dec 13:04:27 2018.793Z | lvl=ERROR | corr=4a6b555e-fd45-11e8-9f4b-000c29173617 | trans=1544533335-855-00000000005 | from=0.0.0.0 | srv=<default> | subsrv=<default> | comp=Orion | op=safeMongo.cpp[196]:getIntField | msg=Runtime Error (field 'expiration' was supposed to be an int but type=18 in BSONObj <{ _id: ObjectId('5c0fb586bee3354142934c09'), description: "Registration for Room5", expiration: 9223372036854775807, servicePath: "/", contextRegistration: [ { entities: [ { id: "Room5", type: "Room" } ], attrs: [ { name: "temperature", type: "" }, { name: "pressure", type: "" } ], providingApplication: "http://mysensors.com/Rooms" } ], format: "JSON" }> from caller setExpires:220)

BSON type 18 is "64-bit integer" according to http://bsonspec.org/spec.html. The field in DB appears as:

"expiration" : NumberLong("9223372036854775807")
fgalan commented 5 years ago

Fixed by PR https://github.com/telefonicaid/fiware-orion/pull/3382