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

contextBroker shuts down when passing inappropriate parameter in query context payload #3055

Closed
saurabhjangir opened this issue Dec 4, 2017 · 5 comments
Labels
Milestone

Comments

@saurabhjangir
Copy link
Contributor

saurabhjangir commented Dec 4, 2017

[root@localhost scripts]# (curl localhost:1026/v1/queryContext -s -S --header 'Content-Type: application/json'  --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
 {
     "entities": [
         {
             "type": "Room",
             "isPattern": "false",
             "id": "Room1"
         }
     ],
     "attributes": [
         "temperature"
     ],
     "value": [
         "700"
     ]
 }
 EOF
**curl: (52) Empty reply from server**
**No JSON object could be decoded**

@fgalan : After this response, fiware orion stops. It is due to providing "value" parameter in payload.

@fgalan fgalan added the bug label Dec 4, 2017
@fgalan
Copy link
Member

fgalan commented Dec 4, 2017

Thanks for the report! I have labeles this issue as bug, while we can have a closer look to it.

Hint: it is better to use code style for curl fragments instead of quote style. I have edited your report to show what I mean :)

@saurabhjangir
Copy link
Contributor Author

saurabhjangir commented Dec 5, 2017

Thanks @fgalan for review and editing this report. For next time, I'll keep your suggestions i mind. :)

@saurabhjangir
Copy link
Contributor Author

In my investigation, I found that in this case Orion is trying to write inside a NULL pointer at line number 175 in file "src/lib/parse/compoundValue.cpp". Here parseDataP->lastContextAttribute is NULL.
Hope this might help.

@saurabhjangir
Copy link
Contributor Author

PULL request #3064 is raised as the fix of this issue.

Earlier we were getting a segmentation fault for the request mentioned in this issue.
REQUEST:

(curl localhost:1026/v1/queryContext -s -S --header 'Content-Type: application/json' \
    --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "Room",
            "isPattern": "false",
            "id": "Room1"
        }
    ],
    "attributes": [
        "temperature"
	],
	"value": [
		"23"
	]
} 
EOF

RESPONSE

curl: (52) Empty reply from server
No JSON object could be decoded

By making this change now we are getting appropriate error message shown below:

{
    "errorCode": {
        "code": "400",
        "details": "JSON Parse Error: unknown field: /value",
        "reasonPhrase": "Bad Request"
    }
}

@fgalan
Copy link
Member

fgalan commented Jan 10, 2018

Fixed by PR #3064

@fgalan fgalan added this to the 1.11.0 milestone Jan 10, 2018
@fgalan fgalan closed this as completed Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants