You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Function lookup with an expected output content type modifies the shared cached function wrapper #1534
SimpleFunctionRegistry.doLookup(..) assigns the requested output mime types to the wrapper it returns (function.expectedOutputContentType = expectedOutputMimeTypes). That wrapper is usually the instance cached in wrappedFunctionDefinitions and shared by all callers, because functions are singletons by default.
This has two consequences:
concurrent lookups of the same function definition with different expected content types (for example HTTP requests with different Accept headers) overwrite each other's value on one shared, non-volatile field, so a request may be converted to the content type that another request asked for
the field is only assigned when mime types are given and is never reset, so a later lookup without mime types still uses the content type left by an earlier caller
The wrapper holds other per-lookup state with the same problem: skipInputConversion, skipOutputConversion, the input header enhancer and propagateInputHeaders.
Proposed change: do not modify the cached wrapper. Return a lightweight per-lookup view or copy when a lookup needs different settings (or pass the expected content type with the invocation), and add a test that looks up the same function concurrently with different content types and verifies that each result uses its own.
SimpleFunctionRegistry.doLookup stored the requested MIME types on the cached singleton wrapper. Each lookup that supplied MIME types overwrote the shared field, and a lookup that omitted them left the previous value in place.
A singleton lookup that specifies output MIME types now returns a separate FunctionInvocationWrapper with those types. The wrapper reuses the same target, preserves composition, conversion, and header settings, and has its own invocation state.
Activity
mvanhorn commentedon Nov 25, 2026
SimpleFunctionRegistry.doLookup stored the requested MIME types on the cached singleton wrapper. Each lookup that supplied MIME types overwrote the shared field, and a lookup that omitted them left the previous value in place.
A singleton lookup that specifies output MIME types now returns a separate FunctionInvocationWrapper with those types. The wrapper reuses the same target, preserves composition, conversion, and header settings, and has its own invocation state.
#1557