Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in HandlerFilterFunction of spring cloud gateway mvc #3650

Open
bruce-jeong opened this issue Dec 20, 2024 · 1 comment
Open

NPE in HandlerFilterFunction of spring cloud gateway mvc #3650

bruce-jeong opened this issue Dec 20, 2024 · 1 comment

Comments

@bruce-jeong
Copy link

Describe the bug
hello.
First of all, the spring cloud gateway mvc version information I use is as follows.

  • org.springframework.cloud:spring-cloud-gateway-server-mvc:4.1.4
image

The following exception occurs while calling HandlerFilterFunction, but it is difficult to determine the cause because the error occurs inside the FilterFunction. Could you please help resolve the issue?

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "jdk.internal.net.http.Http1Exchange$Http1BodySubscriber.request(long)" because "this.bodySubscriber" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1189)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
	at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:453)
	at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsync0$2(MultiExchange.java:341)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "jdk.internal.net.http.Http1Exchange$Http1BodySubscriber.request(long)" because "this.bodySubscriber" is null
	at java.net.http/jdk.internal.net.http.Http1Exchange.requestMoreBody(Http1Exchange.java:544)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:157)
	at java.net.http/jdk.internal.net.http.Http1Exchange.getOutgoing(Http1Exchange.java:608)
	at java.net.http/jdk.internal.net.http.Http1Exchange$Http1Publisher$WriteTask.run(Http1Exchange.java:702)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:303)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:256)
	at java.net.http/jdk.internal.net.http.Http1Exchange.appendToOutgoing(Http1Exchange.java:532)
	at java.net.http/jdk.internal.net.http.Http1Exchange.appendToOutgoing(Http1Exchange.java:526)
	at java.net.http/jdk.internal.net.http.Http1Request$StreamSubscriber.onComplete(Http1Request.java:387)
	at org.springframework.http.client.OutputStreamPublisher$OutputStreamSubscription.invokeHandler(OutputStreamPublisher.java:338)
	... 1 more

Thanks in advance.

Sample
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

@spencergibb
Copy link
Member

I'm afraid without more information on how to replicate the issue, there's not much we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants