iotagent-json
iotagent-json copied to clipboard
MongoError - Topology was destroyed
Sometimes it happens that all calls to the agent don't work, The system returns this response
{
"name": "MongoError",
"message": "Topology was destroyed"
}
Restarting the agent the error disappears.
I'm using version 1.5.0
Thanks for the report!
It could be some kind of problem in the IOTA connection to DB or in the DB itself. Maybe the logs of the IOTA could provide some useful information to help debugging this issue (the log can be long and verbose... I'd suggest to look near the timestamp when the problem starts to happen).
Here it is a message from the log when this error happens:
iotstack_agent-json.1.qhlre44iss8j@vm-1 | time=2019-12-21T04:00:39.073Z | lvl=ERROR | corr=d6e924ac-9c55-447b-aff2-dc608caea292 | trans=d6e924ac-9c55-447b-aff2-dc608caea292 | op=IoTAgentNGSI.DomainControl | srv=n/a | subsrv=n/a | msg=DisconnectedError: Ran out of retries trying to reconnect to "mongodb:27017". Try setting `server.reconnectTries` and `server.reconnectInterval` to something higher. | comp=IoTAgent
Which values do you have in your configuration for server.reconnectTries and server.reconnectInterval? Have you tried the advice of increasing them in order to see if the problem disappears?
Which values do you have in your configuration for server.reconnectTries and server.reconnectInterval? Have you tried the advice of increasing them in order to see if the problem disappears?
Where are these configurations ? Which is the involved component ? (iotAgent or Mongodb ?)
Where are these configurations ? Which is the involved component ? (iotAgent or Mongodb ?)
It corresponds to the mongodb.retries and mongodb.retryTime in config.js or IOTA_MONGO_RETRIES IOTA_MONGO_RETRY_TIME env vars (depending on the configuration style you are using).
The mongodb configuration is described in https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md:
he MongoBD driver will retry the connection at startup time retries times, waiting retryTime seconds between attempts, if those attributes are present (default values are 5 and 5 respectively)
Following your suggestion, I put 2 environment variables with these value:
IOTA_MONGO_RETRIES=10 IOTA_MONGO_RETRY_TIME=10
on the agent configuration, but the problem happens again.
Do you know what can be the correct values to insert?
I'm still using the version 1.5.0
I'm still using the version 1.5.0
This version is pretty old... Could you test with the newest one (1.12.0) please?