[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18122153#comment-18122153
]
David Smiley commented on SOLR-18196:
-
[~gslinker] please take a look at the PR. I just merged it but let us know if
you think it addresses your concern or not.
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18122152#comment-18122152
]
ASF subversion and git services commented on SOLR-18196:
Commit b5c71bc5573c4e31b4cee5a7965d73587fc0ae58 in solr's branch
refs/heads/main from Nick
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=b5c71bc5573 ]
SOLR-18196: Tests: Java serialization for QueryResponse and SimpleOrderedMap
(#4995)
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121731#comment-18121731
]
Nick Shanin commented on SOLR-18196:
I opened PR #4995 for this: [https://github.com/apache/solr/pull/4995]
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18088397#comment-18088397
]
Vadim Kirilchuk commented on SOLR-18196:
Hm, the following test works fine to me on current main(QueryResponseTest):
{noformat}
@Test
public void testQueryResponseSerialization() throws Exception {
XMLResponseParser parser = new XMLResponseParser();
NamedList response; try (SolrResourceLoader loader = new
SolrResourceLoader(Path.of("").toAbsolutePath());
InputStream is = loader.openResource("solrj/sampleDebugResponse.xml")) {
assertNotNull(is);
try (Reader in = new InputStreamReader(is, StandardCharsets.UTF_8)) {
response = parser.processResponse(in);
}
} QueryResponse qr = new QueryResponse(response);
assertNotNull(qr);
assertNotNull(qr.getResults());
assertEquals(2, qr.getResults().getNumFound());
assertNotNull(qr.getExplainMap()); // Serialize
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(qr);
out.close(); // Deserialize
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
QueryResponse deserialized = (QueryResponse) ois.readObject();
ois.close(); // Verify round-trip
assertNotNull(deserialized);
assertNotNull(deserialized.getResults());
assertEquals(qr.getResults().getNumFound(),
deserialized.getResults().getNumFound());
assertEquals(qr.getResults().size(), deserialized.getResults().size());
assertNotNull(deserialized.getExplainMap());
assertEquals(qr.getExplainMap().size(),
deserialized.getExplainMap().size());
}{noformat}
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082039#comment-18082039
]
David Smiley commented on SOLR-18196:
-
In 2008, Ryan McKinley (since long gone) made SolrResponse implement
Serializable; no JIRA. NamedList was Serializable from the beginning. We have
no tests for serialization of either. If we want to "support" this, there at
least has to be a test. Contributions welcome.
Searching for ObjectInputStream & ObjectOutputStream, I see we test we can
serialize (yet no test for deserialize) a SolrQuery (a SolrParams). But that's
basically it.
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081828#comment-18081828
]
Geoffrey Slinker commented on SOLR-18196:
-
"legally dropped", what does that even mean.
This is a regression bug.
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
[jira] [Commented] (SOLR-18196) Java serialization broken for QueryResponse - SimpleOrderedMap implements Map breaks ObjectOutputStream
[
https://issues.apache.org/jira/browse/SOLR-18196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077226#comment-18077226
]
Mikhail Khludnev commented on SOLR-18196:
-
I haven't heard there are contract for Java's serialization for SolrJ and
others', just because Solr has own javabin serialization format. Maybe I miss
something. So, I suppose it was a de facto never guarantee behavior, which were
legally dropped in the next major release. It's sad, but that's it.
> Java serialization broken for QueryResponse - SimpleOrderedMap implements Map
> breaks ObjectOutputStream
>
>
> Key: SOLR-18196
> URL: https://issues.apache.org/jira/browse/SOLR-18196
> Project: Solr
> Issue Type: Bug
> Components: clients - java
>Affects Versions: 10.0
> Environment: Client using SolrJ on Mac OS using Java 21. Solr
> instances running in AWS on EC2 instances.
>Reporter: Geoffrey Slinker
>Priority: Major
>
> Bug Report: Java Serialization Broken for QueryResponse in SolrJ 10.0.0
> Summary
> ---
> org.apache.solr.client.solrj.response.QueryResponse declares "implements
> Serializable" (inherited from SolrResponse) but cannot be serialized using
> Java's ObjectOutputStream in SolrJ 10.0.0. This is a regression from SolrJ
> 9.x where Java serialization worked correctly.
> Affected Version
>
> SolrJ 10.0.0
> Steps to Reproduce
> --
> 1. Obtain a QueryResponse from any SolrClient.query() call.
> 2. Attempt to serialize it with ObjectOutputStream:
>QueryResponse response = solrClient.query("collection", query,
> SolrRequest.METHOD.POST);
>ByteArrayOutputStream baos = new ByteArrayOutputStream();
>ObjectOutputStream oos = new ObjectOutputStream(baos);
>oos.writeObject(response); // FAILS
> Expected Behavior
> -
> The QueryResponse object should serialize successfully, as it did in SolrJ
> 9.x. The class hierarchy declares Serializable:
>SolrResponse implements Serializable (with serialVersionUID)
>SolrResponseBase extends SolrResponse
>QueryResponse extends SolrResponseBase
> Actual Behavior
> ---
> Serialization fails with:
>java.lang.NoSuchFieldException: serialPersistentFields
> The exception is thrown during ObjectOutputStream.writeObject() when Java's
> serialization mechanism attempts to introspect the class hierarchy.
> Root Cause
> --
> In Solr 10.0.0, SimpleOrderedMap was changed to implement java.util.Map as
> part of SIP-22 (NamedList Reduction):
>SolrJ 9.x: public class SimpleOrderedMap extends NamedList
>SolrJ 10.0: public class SimpleOrderedMap extends NamedList
> implements Map
> QueryResponse internally contains a NamedList (via
> SolrResponseBase.response), which at runtime is a SimpleOrderedMap. When
> Java's ObjectOutputStream walks the class hierarchy of SimpleOrderedMap to
> build serialization metadata, it encounters the Map interface and attempts to
> locate serialPersistentFields on the class. This introspection fails with
> NoSuchFieldException, which causes serialization to fail.
> Impact
> --
> Any code that relies on Java serialization of QueryResponse (or any
> SolrResponse subclass containing SimpleOrderedMap instances) is broken. This
> includes:
>- Caching serialized Solr responses
>- Storing Solr responses for test fixtures
>- Any framework that serializes Serializable objects (session replication,
> distributed caches, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
