[Mono-bugs] [Bug 531890] New: Object serialization fails when using GZipStream
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Aug 17 16:43:45 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=531890
Summary: Object serialization fails when using GZipStream
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: x86-64
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: greg.smolyn at strangeloopnetworks.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Created an attachment (id=313367)
--> (http://bugzilla.novell.com/attachment.cgi?id=313367)
Reproduction code for gzip serialization bug
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.2)
Gecko/20090803 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2
In certain circumstances, using the GZipStream and the BinaryFormatter together
results in the following exception when decompressing + deserializing.
Unhandled Exception: System.IO.EndOfStreamException: Failed to read past end of
stream.
at System.IO.BinaryReader.ReadByte () [0x00047] in
/home/strangeloop/src/mono-136007/mcs/class/corlib/System.IO/BinaryReader.cs:293
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.ReadBinaryHeader
(System.IO.BinaryReader reader, System.Boolean& hasHeaders) [0x00000] in
/home/strangeloop/src/mono-136007/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:265
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize
(System.IO.Stream serializationStream,
System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00039] in
/home/strangeloop/src/mono-136007/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:159
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
(System.IO.Stream serializationStream) [0x00000] in
/home/strangeloop/src/mono-136007/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:134
at TestSerialization.MainClass.Main (System.String[] args) [0x0005f] in
/home/strangeloop/src/TestSerialization/Main.cs:30
This does _not_ normally happen when simply writing from a BinaryFormatter to a
GZipStream, but when using an intermediate stream-copy step.
In the error case, the BinaryFormatted data is sent to a memory stream, which
is then copied (with a custom binary copy function) to a GZipStream.
In MS.NET this works fine, however in Mono this fails. Turns out in this
instance the binary copy was extraneous, so there is an easy workaround for us.
However someone else might run into this in the future.
Reproducible: Always
Steps to Reproduce:
1. using a BinaryFormatter, serialize to a memory stream
2. Copy the memory stream to a GZipStream set to compress
3. Decompress and deserialize from the GZipStream
(please see attached solution for reproduction code and the BinaryCopy method
used)
Actual Results:
The exception mentioned above, although in some builds (136007), occasionally
data corruption could be seen and no exception would show up.
Expected Results:
Class should have been properly deserialized.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list