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

1999 connectors connection test endpoints can clog up the whole server #2000

Conversation

adamsachs
Copy link
Contributor

Closes #1999

Code Changes

  • removes the async keyword for the methods that define our connection endpoints that actually test a connection
  • adds a timeout into the fides client's connection test call, so that unexpected hanging from the "child" fides will be more gracefully handled

Steps to Confirm

  • see issue for detailed repro steps. i went through those and confirmed we no longer hold up the web server in the case where the connection test hangs
  • i also confirmed that the new 5 second timeout is respected in these cases, and we get a clean error logged on the parent (as well as a clear connection test response that indicates a faiulre)

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation Updated:
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md

Description Of Changes

Note that another option to resolve this issue would be to keep the endpoints as async functions and instead ensure that all of our connection tests are effectively async down the stack, and ceding control of the event loop when they reach out to make their calls to the external resources. that felt like a big change that would require a fair amount of regression testing, if it's even feasible.

I feel more comfortable going down this route, especially given some of the general guidance found on the fastAPI docs:

If you are using a third party library that communicates with something (a database, an API, the file system, etc.) and doesn't have support for using await, (this is currently the case for most database libraries), then declare your path operation functions as normally, with just def, like:

Copy link
Contributor

@sanders41 sanders41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This seems to be by far the quickest fix right now.

@adamsachs adamsachs merged commit 5a180f6 into main Dec 8, 2022
@adamsachs adamsachs deleted the 1999-connectors-connection-test-endpoints-can-clog-up-the-whole-server branch December 8, 2022 02:03
adamsachs added a commit that referenced this pull request Dec 8, 2022
This was missed in #2000 so just sliding it in here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connector's "connection test" endpoints can clog up the whole server
2 participants