[ 
https://issues.apache.org/jira/browse/TIKA-4704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18071668#comment-18071668
 ] 

ASF GitHub Bot commented on TIKA-4704:
--------------------------------------

Copilot commented on code in PR #2749:
URL: https://github.com/apache/tika/pull/2749#discussion_r3044317046


##########
tika-grpc/src/test/java/org/apache/tika/pipes/grpc/TikaGrpcServerTest.java:
##########
@@ -306,6 +307,10 @@ public void onCompleted() {
             assertEquals(NUM_TEST_DOCS, successes.size());
             assertEquals(1, errors.size());
             assertTrue(finished.get());
+
+            tikaGrpcServerImpl.shutdown();
+            server.shutdown();
+            tikaGrpcServerImpl.postShutdown();

Review Comment:
   The explicit cleanup (tikaGrpcServerImpl.shutdown()/postShutdown() and 
server.shutdown()) is inside the main try block, so if any assertion (or 
earlier exception) fails these calls won’t run and the 
PipesClient/PerClientServerManager temp directory can still be left behind. 
Move this cleanup into a finally (or register a Closeable with the test 
Resources) and ensure the gRPC Server is fully terminated (e.g., 
awaitTermination with a timeout) before calling postShutdown (its javadoc says 
it must be after the server has shut down). Also consider applying the same 
shutdown/postShutdown pattern to testFetcherCrud(), which currently 
instantiates TikaGrpcServerImpl inline and never closes it.





> Avoid remaining temp files
> --------------------------
>
>                 Key: TIKA-4704
>                 URL: https://issues.apache.org/jira/browse/TIKA-4704
>             Project: Tika
>          Issue Type: Task
>    Affects Versions: 3.3.0
>            Reporter: Tilman Hausherr
>            Priority: Minor
>             Fix For: 4.0.0, 3.3.1
>
>         Attachments: screenshot-1.png
>
>
> This is my temp directory after a successful build of tika 3. We should try 
> to lessen this.
>  !screenshot-1.png! 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to