Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netty 5: reader stavation in nio & oio channel #2408

Closed
rzo12345 opened this issue Apr 18, 2014 · 9 comments
Closed

netty 5: reader stavation in nio & oio channel #2408

rzo12345 opened this issue Apr 18, 2014 · 9 comments
Milestone

Comments

@rzo12345
Copy link

hello,

on the same channel when there are continuous writes and some reads the read is never invoked, the only way to get a read invocation is to limit the write by adding Thread.sleep every x writes.

I did not have this issue with netty 3.

i tried setting the iorate to 99 but this did not help. i suppose its not an issue of the nio thread working on io/non-io tasks, but that for some reason data is not being read from the socket.

@rzo12345
Copy link
Author

PS: forgot to mention that this is on the client side. That is, using Bootstrap. With ServerBootstrap all seems to work as expected.

@normanmaurer
Copy link
Member

@rzo12345 could you share a reproducer or your code ?

@rzo12345
Copy link
Author

hello,

to reproduce you can use the echo client/server example. change the client as follows:

    public void run() throws Exception {
        // Configure the client.
        EventLoopGroup group = new NioEventLoopGroup();
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .option(ChannelOption.TCP_NODELAY, true)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ch.pipeline().addFirst(new LoggingHandler(LogLevel.INFO));
                     ch.pipeline().addLast(
                             new ChannelHandlerAdapter()
                             {
                                 @Override
                                    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
                                    {

                                    }
                             });
                 }
             });

            // Start the client.
            ChannelFuture f = b.connect(host, port).sync();
            Channel c = f.channel();
            long l = 0;
            while (c.isActive())
            {
                c.write(c.alloc().buffer().writeLong(l++));
                c.flush();
            }

       } finally {
            // Shut down the event loop to terminate all threads.
            group.shutdownGracefully();
        }
    }

@rzo12345
Copy link
Author

PS: as you may see the the server echoes the messages received and writes them back. but client side channelRead is never invoked.
if you add a sleep(100) into the while loop channelRead is invoked.

@rzo12345
Copy link
Author

PS: i am testing on win XP. when the server is stopped, client side c.isActive() continues to return true.

@rzo12345
Copy link
Author

PS: if a sleep() is added to the while loop the client recognizes the termination of the connection

@rzo12345
Copy link
Author

rzo12345 commented Aug 3, 2014

hello, any progress on this issue ?

@trustin trustin added this to the 4.0.24.Final milestone Oct 15, 2014
@trustin trustin modified the milestones: 4.0.25.Final, 4.0.26.Final Dec 31, 2014
@johnou
Copy link
Contributor

johnou commented Feb 9, 2017

@rzo12345 do you experience the same issue with Netty 4.x?

@Scottmitch
Copy link
Member

I will close this for now. 5.0 was abandoned a while ago. Please open another issue if this problem exists on 4.1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants