Skip to content

InetUtils throw Exception #12321

@shalk

Description

@shalk

Describe the bug
nacos server have some error log, when the server have some special network interface.

java.net.SocketException: No such device (getFlags() failed)
        at java.net.NetworkInterface.isUp0(Native Method)
        at java.net.NetworkInterface.isUp(NetworkInterface.java:399)
        at com.alibaba.nacos.sys.utils.InetUtils.findFirstNonLoopbackAddress(InetUtils.java:195)
        at com.alibaba.nacos.sys.utils.InetUtils.refreshIp(InetUtils.java:107)
        at com.alibaba.nacos.sys.utils.InetUtils.lambda$static$0(InetUtils.java:88)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

InetUtils should catch the exception and continue to check next network interface

Expected behavior
exception not throw from InetUtils.refreshIp()

Actually behavior
throw exception from InetUtils.refreshIp

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See errors

Desktop (please complete the following information):

  • OS: [e.g. Centos]
  • Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions