Skip to content

com.alibaba.csp.sentinel.util.TimeUtil high CPU usage #1702

@wenit

Description

@wenit

Issue Description

Type: bug report or feature request

Describe what happened (or what feature you want)

com.alibaba.csp.sentinel.util.TimeUtil 中死循环,占用了50%左右的cpu

代码如下:

static {
        currentTimeMillis = System.currentTimeMillis();
        Thread daemon = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    currentTimeMillis = System.currentTimeMillis();
                    try {
                        TimeUnit.MILLISECONDS.sleep(1);
                    } catch (Throwable e) {

                    }
                }
            }
        });
        daemon.setDaemon(true);
        daemon.setName("sentinel-time-tick-thread");
        daemon.start();
    }

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

sentinel版本1.7.1

redhat7.4

jdk1.8

Anything else we need to know?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/performanceIssues or PRs related to runtime performancekind/enhancementCategory issues or prs related to enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions