Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-19748

FIWARE.Question.Tech.Subscription at Orion-LD fails with Mongo-DB error.

    Details

      Description

      Created question in FIWARE Q/A platform on 24-06-2022 at 11:06
      Please, ANSWER this question AT https://stackoverflow.com/questions/72743324/subscription-at-orion-ld-fails-with-mongo-db-error

      Question:
      Subscription at Orion-LD fails with Mongo-DB error

      Description:
      I try to get a subscription from Orion-LD to Quantum Leap and CrateDB running. Unfortunately it seems that MongDB throws an error Error (string field 'csf' is missing in BSONObj or Error (string field 'name' is missing in BSONObj' when it tries to access the subscription. The result is that the data can't be passed to Quantum Leap for further processing.
      ...
      time=Friday 24 Jun 11:03:59 2022.081Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[145]:getStringField | msg=Runtime Error (string field 'name' is missing in BSONObj <{ _id: "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e", expiration: 2147483647.0, reference: "http://172.18.1.5:8668/v2/notify&quot;, custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [

      { id: "", isPattern: "", type: "https://uri.fiware.org/ns/data-models#WeatherObserved", isTypePattern: false }

      ], attrs: [ "https://uri.fiware.org/ns/data-models#temperature&quot; ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld&quot;, createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature&quot; ], expression:

      { q: "https://uri=fiware=org/ns/data-models#temperature<100", mq: "", geometry: "", coords: "", georel: "", geoproperty: "" }

      , format: "normalized" }> from caller setName:280)
      time=Friday 24 Jun 11:03:59 2022.081Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[145]:getStringField | msg=Runtime Error (string field 'csf' is missing in BSONObj <{ _id: "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e", expiration: 2147483647.0, reference: "http://172.18.1.5:8668/v2/notify&quot;, custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [

      { id: "", isPattern: "", type: "https://uri.fiware.org/ns/data-models#WeatherObserved", isTypePattern: false }

      ], attrs: [ "https://uri.fiware.org/ns/data-models#temperature&quot; ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld&quot;, createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature&quot; ], expression:

      { q: "https://uri=fiware=org/ns/data-models#temperature<100", mq: "", geometry: "", coords: "", georel: "", geoproperty: "" }

      , format: "normalized" }> from caller setCsf:302)
      ...

      Before that I created and validated the created subscription using
      Creation: http://localhost:1026/ngsi-ld/v1/subscriptions/
      {
      "description": "Notify me of temperature",
      "type": "Subscription",
      "entities": [

      {"type": "WeatherObserved"}

      ],
      "watchedAttributes": ["temperature"],
      "notification": {
      "attributes": ["temperature"],
      "format": "normalized",
      "endpoint":

      { "uri": "http://172.18.1.5:8668/v2/notify", "accept": "application/json" }

      },
      "@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld&quot;
      }

      Validation: http://localhost:1026/ngsi-ld/v1/subscriptions/
      [
      {
      "id": "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e",
      "type": "Subscription",
      "description": "Notify me of temperature",
      "entities": [

      { "type": "WeatherObserved" }

      ],
      "watchedAttributes": [
      "temperature"
      ],
      "q": "https://uri.fiware.org/ns/data-models#temperature&lt;100&quot;,
      "notification": {
      "attributes": [
      "temperature"
      ],
      "format": "normalized",
      "endpoint":

      { "uri": "http://172.18.1.5:8668/v2/notify", "accept": "application/json" }

      },
      "@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld&quot;
      },
      ...

      So it seems that the subscription actually exists and that orion context broker tries to access it actively according to the repeated MongoDB error in Orion-LD logs (docker logs -f <orion ld container>).
      Could this be related to an old MongoDB driver? I found similar issues https://github.com/telefonicaid/fiware-orion/issues/3070.
      Here is my actual docker-compose file:
      version: "3.8"
      services:

      ########

      1. CORE #
        ########
      2. -> Orion: context broker as central component
        orion:
        labels:
        org.test: 'fiware'
        image: fiware/orion-ld:$ {ORION_VERSION}

        hostname: orion
        container_name: fiware-orion
        depends_on:

      • mongo-db
        networks:
        default:
        ipv4_address: 172.18.1.3
        ports:
      • "$ {ORION_PORT}:${ORION_PORT}

        "
        command: -dbhost mongo-db -logLevel DEBUG -noCache
        healthcheck:
        test: curl --fail -s http://orion:$

        {ORION_PORT}

        /version || exit 1
        interval: 5s

      1. -> Context: provide ngsi-ld context file for smart data models
        ld-context:
        labels:
        org.test: 'fiware'
        image: httpd:alpine
        hostname: context
        container_name: fiware-ld-context
        ports:
      • "3004:80"
        networks:
        default:
        ipv4_address: 172.18.1.2
        volumes:
      • ./context:/usr/local/apache2/htdocs/
        healthcheck:
        test: (wget --server-response --spider --quiet http://172.18.1.2/datamodels.context-ngsi.jsonld 2>&1 | awk 'NR==1 {print $$2}

        '| grep -q -e "200") || exit 1

      ##################

      1. DATA MANGEMENT #
        ##################
      2. Quantum Leap: is persisting Short Term History to Crate-DB
        quantumleap:
        labels:
        org.test: 'fiware'
        image: orchestracities/quantumleap:$ {QUANTUMLEAP_VERSION}

        hostname: quantumleap
        container_name: fiware-quantumleap
        depends_on:

      • crate-db
      • redis-db
        networks:
        default:
        ipv4_address: 172.18.1.5
        ports:
      • "$ {QUANTUMLEAP_PORT}:${QUANTUMLEAP_PORT}

        "
        environment:

      • CRATE_HOST=crate-db
      • REDIS_HOST=redis-db
      • REDIS_PORT=$ {REDIS_PORT}
        - LOGLEVEL=DEBUG
        healthcheck:
        test: curl --fail -s http://quantumleap:${QUANTUMLEAP_PORT}/version || exit 1

        #################
        # VISUALIZATION #
        #################
        # -> Grafana: Visualize Time Series data
        grafana:
        labels:
        org.test: 'fiware'
        image: grafana/grafana:6.1.6
        container_name: grafana
        depends_on:
        - crate-db
        networks:
        default:
        ipv4_address: 172.18.1.8
        ports:
        - "3003:3000"
        environment:
        - GF_INSTALL_PLUGINS=https://github.com/orchestracities/grafana-map-plugin/archive/master.zip;grafana-map-plugin,grafana-clock-panel,grafana-worldmap-panel
        volumes:
        - grafana:/var/lib/grafana

        #############
        # DATABASES #
        #############
        # -> MongoDB: database of Orion
        mongo-db:
        labels:
        org.test: 'fiware'
        image: mongo:${MONGO_DB_VERSION}
        hostname: mongo-db
        container_name: db-mongo
        expose:
        - "${MONGO_DB_PORT}"
        ports:
        - "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017 # localhost:27017
        networks:
        default:
        ipv4_address: 172.18.1.4
        volumes:
        - mongo-db:/data
        healthcheck:
        test: |
        host=`hostname --ip-address || echo '127.0.0.1'`;
        mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
        interval: 5s

        # -> CreateDB: database to store time-series data
        crate-db:
        labels:
        org.test: 'fiware'
        image: crate:${CRATE_VERSION}
        hostname: crate-db
        container_name: db-crate
        networks:
        default:
        ipv4_address: 172.18.1.6
        ports:
        # Admin UI
        - "4200:4200"
        # Transport protocol
        - "4300:4300"
        command: crate -Cauth.host_based.enabled=false -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
        environment:
        - CRATE_HEAP_SIZE=2g # see https://crate.io/docs/crate/howtos/en/latest/deployment/containers/docker.html#troubleshooting
        volumes:
        - crate-db:/data

        # -> Redis: Normally used to efficiently store key value pairs
        redis-db:
        labels:
        org.test: 'fiware'
        image: redis:${REDIS_VERSION}
        hostname: redis-db
        container_name: db-redis
        networks:
        default:
        ipv4_address: 172.18.1.7
        ports:
        - "${REDIS_PORT}

        :$

        {REDIS_PORT}

        " # localhost:6379
        volumes:

      • redis-db:/data
        healthcheck:
        test: |
        host=`hostname -i || echo '127.0.0.1'`;
        ping=`redis-cli -h "$host" ping` && [ "$ping" = 'PONG' ] && echo 0 || echo 1
        interval: 10s
      1. NETWORKS
        networks:
        default:
        labels:
        org.test: 'fiware'
        ipam:
        config:
      • subnet: 172.18.1.0/24
      1. VOLUMES
        volumes:
        mongo-db: ~
        context: ~
        grafana: ~
        crate-db: ~
        redis-db: ~

      And my related .env-file:

      1. Project name
        COMPOSE_PROJECT_NAME=fiware
      1. Orion variables
        ORION_PORT=1026
        ORION_VERSION=1.0.0
      1. MongoDB variables
        MONGO_DB_PORT=27017
        MONGO_DB_VERSION=4.4
      1. QuantumLeap Variables
        QUANTUMLEAP_VERSION=0.8.3
        QUANTUMLEAP_PORT=8668
      1. CrateDB Version
        CRATE_VERSION=4.6
      1. RedisDB Version
        REDIS_PORT=6379
        REDIS_VERSION=6

      I would be really appreciated for further help as this issue already blocks me for some days. Thank you in advance!

        Activity

        backlogmanager Backlog Manager created issue -
        Hide
        backlogmanager Backlog Manager added a comment -

        2022-06-25 05:31|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2022-06-25 05:31|CREATED monitor | # answers= 0, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager made changes -
        HD-Enabler Unknown [ 10910 ]
        HD-Chapter Unknown [ 10845 ]
        HD-Node Unknown [ 10852 ]
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2022-06-28 05:31|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2022-06-28 05:31|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        fla Fernando Lopez made changes -
        Assignee Ken Zangelin [ kzangeli ]
        fla Fernando Lopez made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        fla Fernando Lopez made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        backlogmanager Backlog Manager made changes -
        Summary [fiware-stackoverflow] Subscription at Orion-LD fails with Mongo-DB error FIWARE.Question.Tech.Subscription at Orion-LD fails with Mongo-DB error.
        HD-Enabler Unknown [ 10910 ]
        HD-Chapter Unknown [ 10845 ]
        HD-Node Unknown [ 10852 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        3d 1 Backlog Manager 28/Jun/22 7:31 AM
        In Progress In Progress Answered Answered
        9h 36m 1 Fernando Lopez 28/Jun/22 5:08 PM
        Answered Answered Closed Closed
        3s 1 Fernando Lopez 28/Jun/22 5:08 PM

          People

          • Assignee:
            kzangeli Ken Zangelin
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: