ChannelInitializer.initChannel called multiple times

133 views
Skip to first unread message

john meyer

unread,
Sep 20, 2016, 12:30:19 PM9/20/16
to Netty discussions
I am getting a weird behavior in channel pipeline initializer. when a new connection registered, initChannel() called two times. This is happening only when i am testing client socket connection from firefox browser.


Urgent help needed. what is the reason actually.

Netty version: 4.1.5


Rogan Dawes

unread,
Sep 20, 2016, 12:44:13 PM9/20/16
to Netty discussions
Sound like odd behaviour with Firefox.

Are you using ssl, perhaps?

It might be that ff didn't like your certificate, and aborted, then retried.

Rogan
--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/ab87503f-7383-4c0a-b64d-1b5792307089%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

john meyer

unread,
Sep 20, 2016, 1:04:31 PM9/20/16
to Netty discussions, ro...@dawes.za.net
Thanks Rogan,

It is happening for both non-ssl and ssl.

Norman Maurer

unread,
Sep 20, 2016, 1:09:17 PM9/20/16
to ne...@googlegroups.com
Ensure its actually the same connection. I suspect firefox is opening two connections.

john meyer

unread,
Sep 20, 2016, 1:14:12 PM9/20/16
to Netty discussions
Thanks norman

Here is my pipeline

@Override
public void initChannel(SocketChannel ch) throws Exception 
{
logger.info("=================initChannel===================="+this);
ChannelPipeline pipeline = ch.pipeline();

pipeline.addLast("codec-http", new HttpServerCodec());
pipeline.addLast("deflater", new HttpContentCompressor(1));
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
pipeline.addLast(CommonExecutors, "websocket-handler", new WebSocketTransport());
Message has been deleted

john meyer

unread,
Sep 20, 2016, 1:45:59 PM9/20/16
to Netty discussions


On Tuesday, September 20, 2016 at 11:44:07 PM UTC+6, john meyer wrote:
@Norman

Here is the log. when i am making a socket connection, it is trying to create channel from two different port.

Firefox: 48.0.2


[id: 0xa64b3a8b, L:/xyz.422.190.204:5080 - R:/119.30.38.248:41086]
[id: 0xaf7922c3, L:/xyz.422.190.204:5080 - R:/119.30.38.248:41087]




On Tuesday, September 20, 2016 at 11:09:17 PM UTC+6, Norman Maurer wrote:

Norman Maurer

unread,
Sep 20, 2016, 1:53:22 PM9/20/16
to ne...@googlegroups.com
Yeah this means that firefox opened two connections. So its expected to run initChannel(….) two times. One time per Channel (connection)

john meyer

unread,
Sep 20, 2016, 2:04:45 PM9/20/16
to Netty discussions
the thing is, it is trying for two connection but only a single connection getting active so what can be reason of it ?

Rogan Dawes

unread,
Sep 20, 2016, 2:17:24 PM9/20/16
to Netty discussions
Firefox is closing the connection for some reason, and opening a newer one.

Try logging the data transferred, to see what is happening.

john meyer

unread,
Sep 20, 2016, 2:32:40 PM9/20/16
to Netty discussions, ro...@dawes.za.net
Actually,
 i am not sending any data over socket. i am just creating socket connection.
Reply all
Reply to author
Forward
0 new messages