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.

A lot of log will be output and consumed a lot of CPU after network is disconnected on Android devices

See original GitHub issue

I have a trouble about netty when I use micronaut on Android. And I reported an issue to micronaut(https://github.com/micronaut-projects/micronaut-core/issues/4129). But they tell me that I should report the issue to netty.

Expected behavior

Micronaut server stopped normally.

Actual behavior

Micronaut server will be stopped, but a lot of log will be output. And this will take up a lot of CPU resource. Log:

 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@70c8d50.
2020-09-18 14:58:18.405 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.405 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.406 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.406 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@1a42c4e.
2020-09-18 14:58:18.407 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.407 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.409 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.408 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@8352e7c.
2020-09-18 14:58:18.409 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.409 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.411 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.410 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@21abf5a.
2020-09-18 14:58:18.411 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.411 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.413 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.413 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@2e4b668.
2020-09-18 14:58:18.413 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.413 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.415 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.414 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@7357726.
2020-09-18 14:58:18.415 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.415 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
2020-09-18 14:58:18.417 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.417 [nioEventLoopGroup-1-1] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@482d114.
2020-09-18 14:58:18.417 25846-25923/com.example.androidwebtest I/System.out: 14:58:18.417 [nioEventLoopGroup-1-1] INFO io.netty.channel.nio.NioEventLoop - Migrated 1 channel(s) to the new Selector.
......

CPU:

Tasks: 785 total,   4 running, 780 sleeping,   0 stopped,   1 zombie
  Mem:      5.4G total,      5.3G used,      116M free,      175M buffers
 Swap:      2.5G total,      498M used,      2.0G free,      3.0G cached
800%cpu  81%user  14%nice 196%sys 490%idle   0%iow  16%irq   3%sirq   0%host
  PID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ ARGS
25846 u0_a219      10 -10 5.3G 130M  79M S 99.3   2.3   0:15.86 com.example.androidwebtest

Steps to reproduce

  1. Start micronaut and listen the IP of WiFi, but not listen “0.0.0.0”.
  2. Disconect WiFi.

Minimal yet complete reproducer code (or URL to code)

https://github.com/igiantpanda/AndroidWebTest/tree/disconnect-issue

Netty version

4.1.48.Final (The corresponding version of Micronaut is 2.0.0)

JVM version (e.g. java -version)

1.8

OS version (e.g. uname -a)

Android 10 (Tested on Android emulator and OPPO Reno)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hyperxprocommented, Sep 19, 2020

Turn off logging for io.netty.channel.nio.NioEventLoop

I hope that this is a joke. There must be a bug in Netty that causes these messages in the first place.

There is no bug in Netty but in Java NIO. So apart from turn off logging, you can switch to Epoll mechanism. Else, no other option. 😃

1reaction
hyperxprocommented, Sep 19, 2020

Turn off logging for io.netty.channel.nio.NioEventLoop

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading network state - Android Developers
When the network disconnects, the Network object stops being usable; even if the device later reconnects to the same appliance, a new Network...
Read more >
Troubleshooting High CPU Usage - Huawei Support
A large number of logs generated on the device, consuming a lot of CPU resources. How to Locate the High CPU Usage Problem....
Read more >
Wi-Fi Dropping Issues: 2022's Real Tips - Dong Knows Tech
Having trouble staying connected? Here are a collection of tips to likely fix those annoying Wi-Fi dropping, disconnection, and other common ...
Read more >
How to Fix Packet Loss in 8 Steps - Comparitech
In this post, we provide a list of how to fix packet loss and work through some considerations. We then compare the five...
Read more >
Troubleshooting High CPU Utilization in IP Input Process - Cisco
This document explains how to troubleshoot high CPU utilization due to the IP input process.
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