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.

Threads blocked with IN_NATIVE state inside Netty

See original GitHub issue

Expected behavior

All the threads managed by Netty need to co-run to complete all Network I/O initiated from multiple application threads that use Netty.

Actual behavior

We noticed that the system is unable to move further (i.e, JVM Hang) to process new resource creation requests via HTTP RESTful API, as all such calls ended up not having threads to be used to complete the request.

Across 3 thread-dumps spaced between 10-15 seconds , Out of 750 threads available on the system during a Jstack dump, atleast 1/3rd of the JVM threads have blocked on Netty (207 threads).

Thread 25375 - threadId:Thread 25375 - state:IN_NATIVE stackTrace:

  • io.netty.channel.epoll.Native.epollWait0(int, long, int, int) @bci=0 (Compiled frame; information may be imprecise)
  • io.netty.channel.epoll.Native.epollWait(int, io.netty.channel.epoll.EpollEventArray, int) @bci=10, line=109 (Compiled frame)
  • io.netty.channel.epoll.EpollEventLoop.epollWait(boolean) @bci=117, line=232 (Compiled frame)
  • io.netty.channel.epoll.EpollEventLoop.run() @bci=65, line=256 (Compiled frame)
  • io.netty.util.concurrent.SingleThreadEventExecutor$2.run() @bci=13, line=112 (Interpreted frame)
  • io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run() @bci=4, line=145 (Interpreted frame)
  • java.lang.Thread.run() @bci=11, line=748 (Compiled frame)

Steps to reproduce

We have not come up yet with the shortest way to reproduce the problem.

Minimal yet complete reproducer code (or URL to code)

Netty version

3.10.6.Final

JVM version (e.g. java -version)

java version “1.8.0_141” Java™ SE Runtime Environment (build 1.8.0_141-b15) Java HotSpot™ 64-Bit Server VM (build 25.141-b15, mixed mode)

OS version (e.g. uname -a)

Linux cic-2.domain.tld 4.4.0-78-generic #99~14.04.2-Ubuntu SMP Thu Apr 27 18:49:46 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
normanmaurercommented, Jun 13, 2018

Let me close this as I think its not an actual issue (if its an issue then its one because you or the library you are using is creating to many EventLoops). Please re-open if you still think there is an issue and provide more info why you think so.

1reaction
normanmaurercommented, Jun 7, 2018

@vivek-konnect again I think there is nothing wrong with have threads sitting in this state… Its expected if there is no IO ready to be handled atm. The number of threads really depends on how many *EventLoopGroups you have but that’s up to you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netty not processing all incomming request if one handler is ...
This allows to handle 1M+ connections with only a small amount of threads. That said this also means if you "block" one thread...
Read more >
Threads Stuck in java.net.SocketInputStream.socketRead0 API
This post addresses threads in the java.net.SocketInputStream.socketRead0 API and what to do in case a thread is stuck.
Read more >
Threads are blocked and application became unresponsive ...
If threads are BLOCKED for a prolonged period, your application may become unresponsive. ... And also "6 threads" are in a STUCK state....
Read more >
A Tour of Netty. Introduction | by Kondah Mouad | Geek Culture
With this context in place, we'll introduce Netty, its core concepts, and building blocks. 1. Thread Pool Design Pattern. The Thread Pool ...
Read more >
Spring Boot Actuator Web API Documentation
Retrieving the Thread Dump as JSON. 23.1.1. ... State of the thread ( NEW , RUNNABLE , BLOCKED , WAITING ... at io.netty.util.internal....
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