Repository navigation
Load the context registry for modern MCP clients - #7493
Merged
Merged
Conversation
A modern connection sends nothing at startup, so its first request can be the first use of the context-propagation registry. On a thread of the common ForkJoinPool of an executable jar the registry is then created without the accessor of the Reactor context, and every later request fails, on any thread. The registry is now created with the class loader of the application when the modern connections are configured, and loaded again if it does not read the Reactor context. Fixes spring-projects#7489 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
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.
In an executable jar, a modern MCP connection whose first request runs on a thread of the common
ForkJoinPoolfails withNo ContextAccessor for contextType: class reactor.util.context.Context1, and so does every later request, on any thread.The registry of the context-propagation library is created once, with the accessors that the context class loader of the first thread sees, and that thread does not see the accessor of the Reactor context.
A legacy connection sends
initializeat startup; a modern connection sends nothing, so the application decides which thread comes first.When the modern connections are configured, the registry is now created with the class loader of the application.
A registry that exists already and does not read the Reactor context is loaded again.
Nothing is done when
context-propagationis not on the class path.The tests remove the accessor of the Reactor context from the registry and check that it is back: for the loader itself, on a thread that sees no service, and for the connection beans of both client types.
Fixes #7489