Copilot commented on code in PR #2746:
URL: https://github.com/apache/tika/pull/2746#discussion_r3042768290
##########
tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServer.java:
##########
@@ -128,6 +128,9 @@ public void stop() throws InterruptedException {
.shutdown()
.awaitTermination(30, TimeUnit.SECONDS);
}
Review Comment:
`Server.awaitTermination(30, TimeUnit.SECONDS)` returns after the timeout
even if the server is still running; because the return value is ignored,
`postShutdown()` (which closes `pipesClient`) may run while RPCs are still
in-flight. Consider checking the boolean result and only closing `pipesClient`
once termination has actually occurred (or call `shutdownNow()`/wait longer
when the graceful shutdown times out).
##########
tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServer.java:
##########
@@ -128,6 +128,9 @@ public void stop() throws InterruptedException {
.shutdown()
.awaitTermination(30, TimeUnit.SECONDS);
}
+ if (serviceImpl != null) {
+ serviceImpl.postShutdown();
+ }
Review Comment:
If `stop()` is interrupted during `awaitTermination(...)`, it will throw
`InterruptedException` and skip `postShutdown()`, leaving the `pipesClient`
open. Consider ensuring `postShutdown()` runs from a `finally` block (and
re-interrupting the thread if needed) so resources are consistently cleaned up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]