-->

Orion does not notify Cygnus (timeout error)

2019-07-12 18:07发布

问题:

Orion appears not to be able to reach Cygnus, and gives the following warning (I have hidden the IP's):

WARNING@13:33:21  AlarmManager.cpp[303]: Raising alarm NotificationError Y.Y.Y.Y:5050/notify: (curl_easy_perform failed: Timeout was reached)

I first created an entity, then made a subscription, and subsequently updated the entity. For information, here is the entire debug logging from startup of the contextBroker:

INFO@13:31:51  contextBroker.cpp[1808]: Startup completed
INFO@13:32:51  connectionOperations.cpp[626]: Database Operation Successful (command: { listDatabases: 1 })
INFO@13:32:51  connectionOperations.cpp[79]: Database Operation Successful (query: { conditions.type: "ONCHANGE" })
INFO@13:33:16  logMsg.h[1803]: Starting transaction from X.X.X.X:45738/v1/updateContext
INFO@13:33:16  connectionOperations.cpp[79]: Database Operation Successful (query: { _id.id: "1", _id.type: "auto", _id.servicePath: /^\/$/ })
INFO@13:33:16  connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id.id: "1", _id.type: "auto", _id.servicePath: /\// }, { $set: { attrs.kenteken: { value: "TEST", type: "string", creDate: 1457009737, modDate: 1457011996 }, modDate: 1457011996 }, $unset: { location: 1 } }>)
INFO@13:33:16  logMsg.h[1803]: Starting transaction to Y.Y.Y.Y:5050/notify
INFO@13:33:16  logMsg.h[1887]: Transaction ended
INFO@13:33:20  logMsg.h[1803]: Starting transaction from X.X.X.X:45738/v1/subscribeContext
INFO@13:33:20  connectionOperations.cpp[153]: Database Operation Successful (query: { query: { $or: [ { _id.id: "1", _id.type: "auto" } ], _id.servicePath: { $in: [ null, /^$/, /^/.*/ ] }, attrNames: { $in: [ "kenteken", "timestamp" ] } }, orderby: { creDate: 1 } })
INFO@13:33:20  connectionOperations.cpp[153]: Database Operation Successful (query: { query: { $or: [ { _id.id: "1", _id.type: "auto" } ], _id.servicePath: { $in: [ null, /^$/, /^/.*/ ] } }, orderby: { creDate: 1 } })
INFO@13:33:20  logMsg.h[1803]: Starting transaction to Y.Y.Y.Y:5050/notify
INFO@13:33:20  connectionOperations.cpp[336]: Database Operation Successful (insert: { _id: ObjectId('56d83d2070c15b679240ebd6'), expiration: 1459604000, reference: "http://Y.Y.Y.Y:5050/notify", throttling: 1, servicePath: "/#", entities: [ { id: "1", type: "auto", isPattern: "false" } ], attrs: [ "kenteken", "timestamp" ], conditions: [ { type: "ONCHANGE", value: [ "kenteken" ] } ], expression: { q: "", geometry: "", coords: "", georel: "" }, lastNotification: 1457012000, count: 1, format: "JSON" })
INFO@13:33:20  logMsg.h[1887]: Transaction ended
WARNING@13:33:21  AlarmManager.cpp[303]: Raising alarm NotificationError Y.Y.Y.Y:5050/notify: (curl_easy_perform failed: Timeout was reached)
INFO@13:33:21  logMsg.h[1887]: Transaction ended
INFO@13:33:25  logMsg.h[1887]: Transaction ended
INFO@13:33:32  logMsg.h[1803]: Starting transaction from X.X.X.X:45738/v1/updateContext
INFO@13:33:32  connectionOperations.cpp[79]: Database Operation Successful (query: { _id.id: "1", _id.type: "auto", _id.servicePath: /^\/$/ })
INFO@13:33:32  connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id.id: "1", _id.type: "auto", _id.servicePath: /\// }, { $set: { attrs.kenteken: { value: "93XBV4", type: "string", creDate: 1457009737, modDate: 1457012012 }, modDate: 1457012012 }, $unset: { location: 1 } }>)
INFO@13:33:32  logMsg.h[1803]: Starting transaction to Y.Y.Y.Y:5050/notify
INFO@13:33:32  logMsg.h[1887]: Transaction ended
INFO@13:33:32  logMsg.h[1803]: Starting transaction to Y.Y.Y.Y:5050/notify
INFO@13:33:37  logMsg.h[1887]: Transaction ended

What could be the reason for the timeout?

N.B.: I can see the entities being created in the MongoDB (Orion's dbhost), and therefore assume the requests to be correct. This is being confirmed by the fact that the official documentation uses the same format. Cygnus is also configured as per the official documentation, and seems to be working as it should (no errors in the logging, just not receiving data from Orion).

回答1:

Not sure about the cause of this problem, as I'd need more information regarding the security group configuration in Y.Y.Y.Y (as asked in the comment to the question post).

However, the most probable causes of this problem use to be:

  • Cygnus is not started in the Y.Y.Y.Y host.
  • Cygnus is is started in the Y.Y.Y.Y host, but in a port different that 5050
  • Something in the Y.Y.Y.Y host (e.g a firewall or security group) is blocking the incoming notification.
  • Something in the host were Orion is running (e.g a firewall) is blocking the outcoming notification.
  • There is some other network issue is causing the connection problem.


回答2:

I was facing the same problem, but with Orion -> Proton communication. My Proton instance wasn't receiving Orion notifications.

As I'm using Docker for both Orion and Proton, I solved inserting the Proton docker IP in the subscription.

Find your container docker IP with sudo docker network inspect bridge. My Proton container IP was 172.17.0.4.

Then, when you subscribe to a context, use that IP in the contextSubscription payload. In my case, it was "reference": "http://172.17.0.4:8080/ProtonOnWebServer/rest/events",

In your case, using Cygnus, should be something like "reference": "http://<cygnus_docker_ip>:5050/notify",