Zlib compression plus SSL causing problems

Boomah nickdarcy at gmail.com
Fri Nov 5 06:58:47 EDT 2010


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.
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Zlib-compression-plus-SSL-causing-problems-tp5708474p5708474.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list