You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/06/03 04:24:43 UTC

(solr) branch main updated: JavaBinCodec: fix self-suppression risk (#4489)

This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new ffd773b8dcb JavaBinCodec: fix self-suppression risk (#4489)
ffd773b8dcb is described below

commit ffd773b8dcb778407dd34aece4cab7322f85dd4b
Author: David Smiley <ds...@apache.org>
AuthorDate: Wed Jun 3 00:24:37 2026 -0400

    JavaBinCodec: fix self-suppression risk (#4489)
---
 solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 9cd5171f125..dc47f5aa67d 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -1481,7 +1481,10 @@ public class JavaBinCodec implements PushWriter {
 
   @Override
   public void close() throws IOException {
-    if (daos != null) {
+    // marshal() already flushes in its own finally block, so skip the redundant flush.
+    // Flushing again after a marshal failure would re-throw the same exception from the broken
+    // stream, causing "Self-suppression not permitted" in the caller's try-with-resources.
+    if (daos != null && !alreadyMarshalled) {
       daos.flushBuffer();
     }
   }