Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception using subscriptions in a mixed environment (LD and V2) #1649

Open
tudamp opened this issue Jul 29, 2024 · 5 comments
Open

Exception using subscriptions in a mixed environment (LD and V2) #1649

tudamp opened this issue Jul 29, 2024 · 5 comments
Assignees
Labels
bug Something isn't working Fixed - needs validation

Comments

@tudamp
Copy link

tudamp commented Jul 29, 2024

Environment

orion-ld:1.6.0
mongo:3.6

Description

We are using orion-ld in an environment where there are components using the V2 part and others using the LD part.

Recently we realised that when we have both ‘V2-type’ and ‘LD-type’ subscriptions in the same NGSI-Tenant, the call to /v2/subscriptions throws an exception that crashes orion-ld.
The error output is:
terminate called after throwing an instance of ‘mongo::MsgAssertionException’ what(): wrong type for field (_id) 2 != 7

In the same NGSI-Tenant, the call to the LD endpoint is executed correctly.
If no LD subscriptions are present the V2 endpoint responds correctly.

@kzangeli kzangeli self-assigned this Sep 4, 2024
@kzangeli kzangeli added the bug Something isn't working label Sep 4, 2024
@kzangeli
Copy link
Collaborator

kzangeli commented Sep 4, 2024

ok, that definitely sounds like a stupid bug I need to fix.
Could you please provide the exact payload bodies for the two subscriptions.
Having that it should be straightforward to reproduce the issue and then also straightforward to fix it.
Thank you for reporting!

@tudamp
Copy link
Author

tudamp commented Sep 5, 2024

Thank you for your attention!

I realised that it is sufficient to have a registered subscription and then query V2 API

curl -X POST -H 'fiware-service: test' -H 'fiware-servicepath: /#' -H 'content-type: application/ld+json' -d '{
  "description": "Notify me of all product price changes",
  "type": "Subscription",
  "entities": [{"type": "Product"}],
  "watchedAttributes": ["price"],
  "notification": {
    "format": "keyValues",
    "endpoint": {
      "uri": "http://tutorial:3000/subscription/price-change",
      "accept": "application/json"
    }
  },
   "@context": "https://smartdatamodels.org/context.jsonld"
}' http://localhost:1026/ngsi-ld/v1/subscriptions`

and then:

curl -H 'fiware-service: test' http://localhost:1026/v2/subscriptions
curl: (52) Empty reply from server

I hope this helps

@kzangeli
Copy link
Collaborator

kzangeli commented Sep 5, 2024

That should really help. Thanks!

@kzangeli
Copy link
Collaborator

kzangeli commented Sep 6, 2024

So, I implemented a functional test for this.
Only, it doesn't fail. All good ...

I used mongo v3.6 and what I have in the develop branch right now. No error.
I also tried the version 1.6.0 of Orion-LD. Also no problem.
So, not able to reproduce.
Need more input.
Please supply the dockerfile you use for Orion-LD and I'll start my Orion-LD with the exact same parameters.
In my test I used only:

-multiservice [-experimental]

(I tried both with and without the -experimental CLI)

kzangeli added a commit that referenced this issue Sep 6, 2024
@kzangeli kzangeli mentioned this issue Sep 6, 2024
@kzangeli
Copy link
Collaborator

kzangeli commented Sep 6, 2024

Forget the comment about not being able to reproduce.
I did the GET /subscriptions using LD and not V2.
Once I realized my mistake, I reproduced the crash immediately, and in a few minutes I fixed it.
PR on its way, should be ready in an hour or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed - needs validation
Projects
None yet
Development

No branches or pull requests

2 participants