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

http-api: T5006: add explicit async to retrieve/configure methods for REST #1823

Merged
merged 1 commit into from Feb 15, 2023

Conversation

jestabro
Copy link
Contributor

@jestabro jestabro commented Feb 15, 2023

Change Summary

The REST endpoints 'retrieve' and 'configure' can reveal a segfault under concurrent connections unless methods are defined explicitly as 'async'. Add async modifier to methods.

This affects only Sagitta REST requests; the segfault will occur in the underlying libc, in vyatta-cfg, respectively, libvyosconfig. Equuleus is not affected, nor are GraphQL requests.

Note that the underlying web framework for the http-api, FastAPI, automatically takes care of red/blue function issues, 'usually'; here is a case where we must be explicit.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

Proposed changes

How to test

Thanks to the user who opened the bug report, testing may be done with:

npx autocannon --duration 10 --connections 4 --renderStatusCodes --method POST --form '{"data": {"type":"text", "value": "{\"op\": \"showConfig\", \"path\": []}"}, "key": {"type":"text","value":"qwerty"}}' 'https://host-name/retrieve'

respectively

npx autocannon --duration 10 --connections 4 --renderStatusCodes --method POST --form '{"data": {"type":"text", "value": "{\"op\": \"set\", \"path\": [\"interfaces\", \"ethernet\", \"eth0\", \"description\", \"baz\"]}"}, "key": {"type":"text","value":"qwerty"}}' 'https://host-name/configure'

for suitable 'host-name'.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@jestabro jestabro self-assigned this Feb 15, 2023
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, sever-sever and c-po and removed request for a team February 15, 2023 16:35
@sever-sever sever-sever merged commit d530c03 into vyos:current Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants