Skip to content

serialize downstream signals in CompletionStageSubscriber - #4563

Open
nab-iha3 wants to merge 1 commit into
graphql-java:masterfrom
nab-iha3:subscription-serialize-onnext
Open

nab-iha3 wants to merge 1 commit into
graphql-java:masterfrom
nab-iha3:subscription-serialize-onnext

Conversation

@nab-iha3

Copy link
Copy Markdown
Contributor

subscription { ticks { name } } with default settings and an async Tick.name fetcher, two events resolving on two pool threads, subscriber counting callers inside onNext:

pool-1-thread-1 onNext {ticks={name=event-0}} active=2
pool-1-thread-2 onNext {ticks={name=event-1}} active=1
max concurrent onNext calls = 2

CompletionStageSubscriber backs the default (unordered) subscription publisher and calls downstreamSubscriber.onNext from whenNextFinished on whichever thread completes each event's promise, outside its lock, so events resolving on different threads reach the subscriber at the same time (reactive streams rule 1.3). onError can overlap an in-progress onNext the same way, and a value that was already completing can still be delivered after onError. the TCK runs here skip the stochastic spec103 check and complete every promise on a single-thread executor, and CapturingSubscriber synchronizes its own onNext, so the tests never hit it.

onNext and onError now reach the downstream subscriber under the existing lock, and onNext is skipped once the subscriber is terminal. CompletionStageOrderedSubscriber already delivered onNext under that lock; its drain loop now also stops once terminal. the two new CompletionStageSubscriberTest cases run against both subscribers and fail before the change (unordered: both, ordered: the onError one).

@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 17 6373 (+4 🟢) 6318 (+4 🟢) 0 (±0) 0 (±0) 55 (±0)
Java 21 6373 (+4 🟢) 6318 (+4 🟢) 0 (±0) 0 (±0) 55 (±0)
Java 25 6373 (+4 🟢) 6318 (+4 🟢) 0 (±0) 0 (±0) 55 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 19151 (+12 🟢) 18986 (+12 🟢) 0 (±0) 0 (±0) 165 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 26788 2698 90.8% ±0.0%
Branches 7685 1170 86.8% ±0.0%
Methods 7418 1091 87.2% ±0.0%

Changed Class Coverage (2 classes)

Class Line Branch Method
g.e.r.CompletionStageOrderedSubscriber ±0.0% +1.2% 🟢 ±0.0%
g.e.r.CompletionStageSubscriber +0.2% 🟢 +1.6% 🟢 +0.7% 🟢

Full HTML report: build artifact jacoco-html-report

Updated: 2026-11-15 05:37:10 UTC

This branch has not been deployed

No deployments
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.

1 participant