[vdk-plugins] vdk-kerberos-auth: Separate async event loop#885
Merged
Conversation
8c48da3 to
813e93e
Compare
projects/vdk-plugins/vdk-kerberos-auth/src/vdk/plugin/kerberos/minikerberos_authenticator.py
Outdated
Show resolved
Hide resolved
projects/vdk-plugins/vdk-kerberos-auth/tests/jobs/test-job/20_async_test.py
Show resolved
Hide resolved
c0314ac to
923d6d7
Compare
antoniivanov
reviewed
Jul 7, 2022
projects/vdk-plugins/vdk-kerberos-auth/src/vdk/plugin/kerberos/minikerberos_authenticator.py
Outdated
Show resolved
Hide resolved
antoniivanov
reviewed
Jul 7, 2022
projects/vdk-plugins/vdk-kerberos-auth/src/vdk/plugin/kerberos/minikerberos_authenticator.py
Outdated
Show resolved
Hide resolved
The minikerberos authenticator relies on an async kerberos client to speed up some of its processes. This client uses `asyncio.run()` to execute async operations. As can be seen from the source code of asyncio, https://github.com/python/cpython/blob/3.10/Lib/asyncio/runners.py, the `run()` method creates a new event loop and sets it as the [default loop](https://github.com/python/cpython/blob/3.10/Lib/asyncio/runners.py#L41). When all async operations are finished, the loop it terminated and all tasks are cleaned. This is fine in general, as long as other components don't rely on the main event loop. If they do, however, we could end up in a situation, where the kerberos plugin closes the asyncio main event loop, and breaks the other components that rely on the same thread. To avoid issues with multiple components relying on the asyncio main event loop, this change introduces a separate event loop for the minikerberos authenticator, thus keeping kerberos operations away of the main event loop. Testing done: Functional test added. Signed-off-by: Andon Andonov <andonova@vmware.com>
923d6d7 to
c4c30b7
Compare
antoniivanov
approved these changes
Jul 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The minikerberos authenticator relies on an async kerberos client to speed up some of its
processes. This client uses
asyncio.run()to execute async operations. As can be seen from the sourcecode of asyncio, https://github.com/python/cpython/blob/3.10/Lib/asyncio/runners.py, the
run()methodcreates a new event loop and sets it as the default loop.
When all async operations are finished, the loop it terminated and all tasks are cleaned. This is fine
in general, as long as other components don't rely on the main event loop.
If they do, however, we could end up in a situation, where the kerberos plugin closes the asyncio
main event loop, and breaks the other components that rely on the same thread.
To avoid issues with multiple components relying on the asyncio main event loop, this change introduces
a separate event loop for the minikerberos authenticator, thus keeping kerberos operations away of the main
event loop.
Testing done: Functional test added.
Signed-off-by: Andon Andonov andonova@vmware.com