Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
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", custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [
], attrs: [ "https://uri.fiware.org/ns/data-models#temperature" ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld", createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature" ], 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", custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [
], attrs: [ "https://uri.fiware.org/ns/data-models#temperature" ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld", createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature" ], 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": [
],
"watchedAttributes": ["temperature"],
"notification": {
"attributes": ["temperature"],
"format": "normalized",
"endpoint":
},
"@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld"
}
Validation: http://localhost:1026/ngsi-ld/v1/subscriptions/
[
{
"id": "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e",
"type": "Subscription",
"description": "Notify me of temperature",
"entities": [
],
"watchedAttributes": [
"temperature"
],
"q": "https://uri.fiware.org/ns/data-models#temperature<100",
"notification": {
"attributes": [
"temperature"
],
"format": "normalized",
"endpoint":
},
"@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld"
},
...
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:
########
- CORE #
######## - -> 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}
"
{ORION_PORT}
command: -dbhost mongo-db -logLevel DEBUG -noCache
healthcheck:
test: curl --fail -s http://orion:$/version || exit 1
interval: 5s
- -> 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
##################
- DATA MANGEMENT #
################## - 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
- NETWORKS
networks:
default:
labels:
org.test: 'fiware'
ipam:
config:
- subnet: 172.18.1.0/24
- VOLUMES
volumes:
mongo-db: ~
context: ~
grafana: ~
crate-db: ~
redis-db: ~
And my related .env-file:
- Project name
COMPOSE_PROJECT_NAME=fiware
- Orion variables
ORION_PORT=1026
ORION_VERSION=1.0.0
- MongoDB variables
MONGO_DB_PORT=27017
MONGO_DB_VERSION=4.4
- QuantumLeap Variables
QUANTUMLEAP_VERSION=0.8.3
QUANTUMLEAP_PORT=8668
- CrateDB Version
CRATE_VERSION=4.6
- 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
- All
- Comments
- History
- Activity
- Transitions