Copilot commented on code in PR #4930:
URL: https://github.com/apache/solr/pull/4930#discussion_r4207315263


##########
solr/modules/extraction/src/java/org/apache/solr/handler/extraction/TikaServerExtractionBackend.java:
##########
@@ -447,13 +447,10 @@ private void 
appendBackCompatTikaMetadata(ExtractionMetadata md) {
 
   @Override
   public void close() {
-    RefCounted<HttpClientResources> ref;
-    synchronized (INIT_LOCK) {
-      ref = acquiredResourcesRef;
-      acquiredResourcesRef = null;
-    }
-    if (ref != null) {
-      ref.decref();
+    if (closed.compareAndSet(false, true)) {
+      synchronized (INIT_LOCK) {
+        acquiredResourcesRef.decref();

Review Comment:
   This race-condition fix has no regression coverage, although this backend 
already has a dedicated test suite. Please add a test that coordinates the last 
backend’s `close()` with construction of another backend and verifies the newly 
acquired backend can still complete a request (and that repeated `close()` is 
harmless); otherwise a future change could reintroduce the stopped-client 
handoff without detection.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to