Zlib compression plus SSL causing problems

Johnny Luong johnny.luong at trustcommerce.com
Fri Nov 5 17:04:49 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/05/2010 03:58 AM, Boomah wrote:
> Hi all.
> 
> I've ran into an inconsistent problem that occurs when I have both Zlib
> compression and SSL encoding enabled.
> 
> This is how I set up the pipeline:
> 
>     pipeline.addLast("ssl", new SslHandler(engine))
>     pipeline.addLast("compress", new ZlibEncoder(1))
>     pipeline.addLast("encoder", new ObjectEncoder())
>     pipeline.addLast("decompress", new ZlibDecoder())
>     pipeline.addLast("decoder", new ObjectDecoder(25 * 1024 * 1024))
>     pipeline.addLast("idle", new IdleStateHandler(timer, 0, 0, 5))
>     pipeline.addLast("threadPool", new
> ExecutionHandler(Executors.newCachedThreadPool(new
> NamedDaemonThreadFactory("Server worker"))))
> 
> plus my handler.
> 
> 
> I've got a unit test that fires off lots of messages and at an indeterminate
> time it fails with a message like this:
> 
> invalid type code: 00
> java.io.StreamCorruptedException: invalid type code: 00
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356)
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
> 	at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
> 	at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> 	at
> org.jboss.netty.handler.codec.serialization.ObjectDecoder.decode(ObjectDecoder.java:94)
> 	at
> org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282)
> 	at
> org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
> 	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
> 	at
> org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:76)
> 	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
> 	at
> org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
> 	at
> org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
> 	at
> org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
> 	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
> 	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
> 	at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
> 	at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)
> 	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
> 	at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> 
> 
> If I take out the SSL it works fine. If I put SSL back in and take out the
> compression it works fine.
> 
> With both of them in I get this exception.
> 
> Am I doing something completely the wrong way round or have I discovered a
> bug?
> 
> Thanks, Nick.

Hmmm, does it fail indeterminately when you remove the ExecutionHandler
or when you use the OrderedMemoryAwareThreadPoolExecutor?

Best,
Johnny

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkzUcXEACgkQg7TIS7A9isfVWACgsTJFlscVagA3g1q+3rIUNKWk
K9gAnit/3q5teBmkeSQxhXMBmFUre0Ck
=sCai
-----END PGP SIGNATURE-----


More information about the netty-users mailing list