question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Why does my netty is unresponsible after two blocked request?

See original GitHub issue

Expected behavior

I expect I/O Threads to keep consuming requests.

Actual behavior

After 2 blocked requests. It starts to not accepting requests. Even If I am using 16 Threads as a child worker Thread

Steps to reproduce

1-) Send open the websocket request 2-) On the Server side block the in the coming event before handshake for 20 Secs (In My real case, It is a blocked JDBC call before the handshake. I need to validate the incoming request with querying DB before opening the socket) 3-) Do It above Steps two times 4-) For requests after 3, the server starts to not answering until the first blocking request done.

Minimal yet complete reproducer code (or URL to code)

@Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpRequest httpRequest) {
    Thread.sleep(20000); // Represents my blocked logic before handshake
    // Handsake or not with result
    Do stuff...
    }
    
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup();

ChannelPipeline pipeline = socketChannel.pipeline();
        pipeline.addLast(new HttpObjectAggregator(65536));
        pipeline.addLast(HTTP_CODEC.value(), new HttpServerCodec());
        .
        .
        .

Netty version

4.1.59.Final

JVM version (e.g. java -version)

1.8 don’t be mad at me 😛

I am passing blocked business logic to the custom thread pool. But, In the handshake case, I can not do that. and After two blocked requests my netty server is unresponsible until the first one ends. Is there any good way to handle the blocked handshake logic without block child threads.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hyperxprocommented, Jun 17, 2021

Aaaaaaaaaaaaa, I gotcha. You’re using ‘SimpleChannelInboundHandler’. It’ll release Http Request as soon as it finishes processing channelRead0. (Even before your logic finishes in 500ms).

Use ChannelInboundHandler.

0reactions
ykalaycommented, Jun 18, 2021

Thanks for the help @hyperxpro It was about to retain/release the message as you said. Very thanks for the answer to my question

Read more comments on GitHub >

github_iconTop Results From Across the Web

micronaut rest response hangs regularly - netty - Stack Overflow
Turns out blocking operations within io.micronaut.http.filter.HttpServerFilter will block the Netty event loop, and will have the symptom I ...
Read more >
blocking netty thread causes a calling http client to hang #2593
In my opinion Micronaut should never try to assign an http request handling to a thread that is blocked but apparently this is...
Read more >
How to Handle Sudden Burst in New HTTPS Connections?
This tells the ssl handler to use tasks when handling the requests so that it is non-blocking. java -Dio.netty.handler.ssl.openssl.
Read more >
Nasal passage blocked | Mayo Clinic Connect
Anyone else have one nasal passage totally blocked all the time? I use neti pot, saline spray, etc but never is unblocked. I...
Read more >
Neti pots: Uses, dangers, and warnings - Medical News Today
It should take the water 1-2 minutes to flow through each nostril. Repeat these steps until sinus symptoms resolve, such as in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found