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

Race condition updating resource's metadata and data #179

Open
offtherailz opened this issue May 2, 2018 · 0 comments
Open

Race condition updating resource's metadata and data #179

offtherailz opened this issue May 2, 2018 · 0 comments

Comments

@offtherailz
Copy link
Member

doing in parallel 2 PUT requests for resource and resource/data, only the first is applied. This is because data request read the resource to get the id, updates the data and then modify last-update date in the resource, but in the meanwhile the resource has been modified.
Tipical example of critical section.

sample requests (missing authentication) :
PUT resource

curl 'http://localhost:8081/rest/geostore/resources/resource/5728' -X PUT -H 'Pragma: no-cache' -H 'Origin: http://localhost:8081' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: it' -H -H 'Content-Type: application/xml' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36' -H 'Connection: keep-alive' -H 'Referer: http://localhost:8081/?debug=true' --data-binary '<Resource><description></description><metadata></metadata><name>test dashboard 4</name></Resource>' --compressed

PUT data

curl 'http://localhost:8081/rest/geostore/data/5728' -X PUT -H 'Pragma: no-cache' -H 'Origin: http://localhost:8081' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: it' -H 'Content-Type: application/json; charset=UTF-8"' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36' -H 'Connection: keep-alive' -H 'Referer: http://localhost:8081/?debug=true' --data-binary '{"widgets":[{"id":"252bb010-49f7-11e8-9f59-630c9298622e","layer":false,"url":false,"legend":false,"mapSync":false,"widgetType":"text","dataGrid":{"y":0,"x":0,"w":1,"h":1},"title":"test","text":"<p>test</p>"}],"layouts":{"lg":[{"w":1,"h":1,"x":0,"y":0,"i":"252bb010-49f7-11e8-9f59-630c9298622e","moved":false,"static":false}],"md":[{"w":1,"h":1,"x":0,"y":0,"i":"252bb010-49f7-11e8-9f59-630c9298622e","moved":false,"static":false}],"xs":[{"w":1,"h":1,"x":0,"y":0,"i":"252bb010-49f7-11e8-9f59-630c9298622e","moved":false,"static":false}]}}' --compressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant