Commit c1ee7d3 1 parent d02f655 commit c1ee7d3 Copy full SHA for c1ee7d3
File tree 1 file changed +5
-0
lines changed
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,11 @@ private static Single<StreamingHttpResponse> executeRequest(final StreamingHttpR
221
221
// chain and accidentally subscribed to the same request concurrently. This protection helps them avoid
222
222
// ambiguous runtime behavior caused by a corrupted mutable request state.
223
223
final Object inFlight ;
224
+ // Note that because request.context() lazily allocates a new ContextMap, there is a risk that
225
+ // synchronization will happen on two different contexts. However, this is acceptable compromise because:
226
+ // - Most likely users subscribe 2+ times to the same request from the same thread.
227
+ // - This is the best effort protection, giving users at least one rejection should be enough to let them
228
+ // know their code is incorrect and should be rewritten.
224
229
synchronized (context ) {
225
230
// We do not override lock because other layers may already set their own one.
226
231
inFlight = context .putIfAbsent (HTTP_IN_FLIGHT_REQUEST , lock );
You can’t perform that action at this time.
0 commit comments