You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Ben West <bw...@yahoo.com> on 2010/07/01 23:59:04 UTC
Serialization error
Hi all,
I am seeing a deserialization error. It only happens on certain servers, and I can't track down why. Wondering if anyone has any information.
I have a binary serialized version of a BooleanQuery. I then do:
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream(Query);
Query deserializedQuery = (Query)bf.Deserialize(ms);
The last line fails with
Unknown parameter value: SHOULD
at Lucene.Net.Util.Parameter.ReadResolve() in C:\Lucene.NET\C#\src\Lucene.Net\Util\Parameter.cs:line 70
at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
Does anyone know what this could be? Like I said, it works on most of the computers here, but a couple of our web servers throw this.
Thanks,
-Ben
RE: Serialization error
Posted by Moray McConnachie <mm...@oxford-analytica.com>.
I have had problems in Util.Parameter serialization with ReadResolve in
the past. Digy was kind enough to provide a patch in the past, if I
remember rightly.
See https://issues.apache.org/jira/browse/LUCENENET-338
And https://issues.apache.org/jira/browse/LUCENENET-170
I wonder if it is the same issue?
-------------------------------------
Moray McConnachie
Director of IT +44 1865 261 600
Oxford Analytica http://www.oxan.com
-----Original Message-----
From: Ben West [mailto:bwsithspawn00@yahoo.com]
Sent: 01 July 2010 22:59
To: lucene-net-user@lucene.apache.org
Subject: Serialization error
Hi all,
I am seeing a deserialization error. It only happens on certain servers,
and I can't track down why. Wondering if anyone has any information.
I have a binary serialized version of a BooleanQuery. I then do:
BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new
MemoryStream(Query); Query deserializedQuery =
(Query)bf.Deserialize(ms);
The last line fails with
Unknown parameter value: SHOULD
at Lucene.Net.Util.Parameter.ReadResolve() in
C:\Lucene.NET\C#\src\Lucene.Net\Util\Parameter.cs:line 70
at
System.Runtime.Serialization.ObjectManager.ResolveObjectReference(Object
Holder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(
HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deseriali
ze(Stream serializationStream, HeaderHandler handler, Boolean fCheck,
Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deseriali
ze(Stream serializationStream)
Does anyone know what this could be? Like I said, it works on most of
the computers here, but a couple of our web servers throw this.
Thanks,
-Ben
RE: Serialization error
Posted by Digy <di...@gmail.com>.
Sorry. It works:(
DIGY
-----Original Message-----
From: Ben West [mailto:bwsithspawn00@yahoo.com]
Sent: Friday, July 02, 2010 6:39 PM
To: lucene-net-user@lucene.apache.org
Subject: RE: Serialization error
Note that it works on almost all the machines that I test, so it will
probably work for you. But hopefully not :P
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Lucene.Net.Search;
using Lucene.Net.Index;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace Test
{
class Program
{
// this method is the "client"
static void Main(string[] args)
{
BooleanQuery bq = new BooleanQuery();
TermQuery tq = new TermQuery(new Term("test", "test"));
bq.Add(tq, BooleanClause.Occur.SHOULD);
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, bq);
Server(ms.ToArray());
}
// this method pretends to be the server which is listening
static void Server(byte[] SerializedQuery){
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream(SerializedQuery);
Query myQuery = (Query)bf.Deserialize(ms); //this line will
fail
Console.WriteLine("Deserialized Query: " + myQuery.ToString());
Console.ReadLine();
}
}
}
Thanks!
-Ben
--- On Fri, 7/2/10, Digy <di...@gmail.com> wrote:
> From: Digy <di...@gmail.com>
> Subject: RE: Serialization error
> To: lucene-net-user@lucene.apache.org
> Date: Friday, July 2, 2010, 10:27 AM
> Hi Ben,
> Can you send a simple test case?
>
> DIGY
>
> -----Original Message-----
> From: Ben West [mailto:bwsithspawn00@yahoo.com]
>
> Sent: Friday, July 02, 2010 6:09 PM
> To: lucene-net-user@lucene.apache.org
> Subject: Re: Serialization error
>
> That's what I thought too, but it fails when the "client"
> and "server" are
> the same process, which seems to indicate that it's not a
> version mismatch.
>
> Thanks!
> -Ben
>
> --- On Fri, 7/2/10, Robert Jordan <ro...@gmx.net>
> wrote:
>
> > From: Robert Jordan <ro...@gmx.net>
> > Subject: Re: Serialization error
> > To: lucene-net-user@incubator.apache.org
> > Date: Friday, July 2, 2010, 4:28 AM
> > On 01.07.2010 23:59, Ben West wrote:
> > > Does anyone know what this could be? Like I said,
> it
> > works on most of the computers here, but a couple of
> our web
> > servers throw this.
> >
> > It looks like a version mismatch. i.e. these specific
> > machines
> > are running a different Lucene.NET version.
> >
> > Robert
> >
> >
>
>
>
>
>
RE: Serialization error
Posted by Ben West <bw...@yahoo.com>.
Note that it works on almost all the machines that I test, so it will probably work for you. But hopefully not :P
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Lucene.Net.Search;
using Lucene.Net.Index;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace Test
{
class Program
{
// this method is the "client"
static void Main(string[] args)
{
BooleanQuery bq = new BooleanQuery();
TermQuery tq = new TermQuery(new Term("test", "test"));
bq.Add(tq, BooleanClause.Occur.SHOULD);
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, bq);
Server(ms.ToArray());
}
// this method pretends to be the server which is listening
static void Server(byte[] SerializedQuery){
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream(SerializedQuery);
Query myQuery = (Query)bf.Deserialize(ms); //this line will fail
Console.WriteLine("Deserialized Query: " + myQuery.ToString());
Console.ReadLine();
}
}
}
Thanks!
-Ben
--- On Fri, 7/2/10, Digy <di...@gmail.com> wrote:
> From: Digy <di...@gmail.com>
> Subject: RE: Serialization error
> To: lucene-net-user@lucene.apache.org
> Date: Friday, July 2, 2010, 10:27 AM
> Hi Ben,
> Can you send a simple test case?
>
> DIGY
>
> -----Original Message-----
> From: Ben West [mailto:bwsithspawn00@yahoo.com]
>
> Sent: Friday, July 02, 2010 6:09 PM
> To: lucene-net-user@lucene.apache.org
> Subject: Re: Serialization error
>
> That's what I thought too, but it fails when the "client"
> and "server" are
> the same process, which seems to indicate that it's not a
> version mismatch.
>
> Thanks!
> -Ben
>
> --- On Fri, 7/2/10, Robert Jordan <ro...@gmx.net>
> wrote:
>
> > From: Robert Jordan <ro...@gmx.net>
> > Subject: Re: Serialization error
> > To: lucene-net-user@incubator.apache.org
> > Date: Friday, July 2, 2010, 4:28 AM
> > On 01.07.2010 23:59, Ben West wrote:
> > > Does anyone know what this could be? Like I said,
> it
> > works on most of the computers here, but a couple of
> our web
> > servers throw this.
> >
> > It looks like a version mismatch. i.e. these specific
> > machines
> > are running a different Lucene.NET version.
> >
> > Robert
> >
> >
>
>
>
>
>
RE: Serialization error
Posted by Digy <di...@gmail.com>.
Hi Ben,
Can you send a simple test case?
DIGY
-----Original Message-----
From: Ben West [mailto:bwsithspawn00@yahoo.com]
Sent: Friday, July 02, 2010 6:09 PM
To: lucene-net-user@lucene.apache.org
Subject: Re: Serialization error
That's what I thought too, but it fails when the "client" and "server" are
the same process, which seems to indicate that it's not a version mismatch.
Thanks!
-Ben
--- On Fri, 7/2/10, Robert Jordan <ro...@gmx.net> wrote:
> From: Robert Jordan <ro...@gmx.net>
> Subject: Re: Serialization error
> To: lucene-net-user@incubator.apache.org
> Date: Friday, July 2, 2010, 4:28 AM
> On 01.07.2010 23:59, Ben West wrote:
> > Does anyone know what this could be? Like I said, it
> works on most of the computers here, but a couple of our web
> servers throw this.
>
> It looks like a version mismatch. i.e. these specific
> machines
> are running a different Lucene.NET version.
>
> Robert
>
>
Re: Serialization error
Posted by Ben West <bw...@yahoo.com>.
That's what I thought too, but it fails when the "client" and "server" are the same process, which seems to indicate that it's not a version mismatch.
Thanks!
-Ben
--- On Fri, 7/2/10, Robert Jordan <ro...@gmx.net> wrote:
> From: Robert Jordan <ro...@gmx.net>
> Subject: Re: Serialization error
> To: lucene-net-user@incubator.apache.org
> Date: Friday, July 2, 2010, 4:28 AM
> On 01.07.2010 23:59, Ben West wrote:
> > Does anyone know what this could be? Like I said, it
> works on most of the computers here, but a couple of our web
> servers throw this.
>
> It looks like a version mismatch. i.e. these specific
> machines
> are running a different Lucene.NET version.
>
> Robert
>
>
Re: Serialization error
Posted by Robert Jordan <ro...@gmx.net>.
On 01.07.2010 23:59, Ben West wrote:
> Does anyone know what this could be? Like I said, it works on most of the computers here, but a couple of our web servers throw this.
It looks like a version mismatch. i.e. these specific machines
are running a different Lucene.NET version.
Robert
Re: Serialization error
Posted by Ben West <bw...@yahoo.com>.
Alternatively, if people have suggestions about how to send Queries through WCF I'd be interested in hearing about it.
Thanks,
-Ben
--- On Thu, 7/1/10, Ben West <bw...@yahoo.com> wrote:
> From: Ben West <bw...@yahoo.com>
> Subject: Serialization error
> To: lucene-net-user@lucene.apache.org
> Date: Thursday, July 1, 2010, 4:59 PM
> Hi all,
>
> I am seeing a deserialization error. It only happens on
> certain servers, and I can't track down why. Wondering if
> anyone has any information.
>
> I have a binary serialized version of a BooleanQuery. I
> then do:
>
> BinaryFormatter bf = new BinaryFormatter();
> MemoryStream ms = new MemoryStream(Query);
> Query deserializedQuery = (Query)bf.Deserialize(ms);
>
> The last line fails with
> Unknown parameter value: SHOULD
> at
> Lucene.Net.Util.Parameter.ReadResolve() in
> C:\Lucene.NET\C#\src\Lucene.Net\Util\Parameter.cs:line 70
> at
> System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder
> holder)
> at
> System.Runtime.Serialization.ObjectManager.DoFixups()
> at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
> handler, __BinaryParser serParser, Boolean fCheck, Boolean
> isCrossAppDomain, IMethodCallMessage methodCallMessage)
> at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
> serializationStream, HeaderHandler handler, Boolean fCheck,
> Boolean isCrossAppDomain, IMethodCallMessage
> methodCallMessage)
> at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
> serializationStream)
>
>
> Does anyone know what this could be? Like I said, it works
> on most of the computers here, but a couple of our web
> servers throw this.
>
> Thanks,
> -Ben
>
>
>
>
>