Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-1012: cpu_sup:util() always return 100.0 #3871

Closed
OTP-Maintainer opened this issue Jul 29, 2019 · 4 comments
Closed

ERL-1012: cpu_sup:util() always return 100.0 #3871

OTP-Maintainer opened this issue Jul 29, 2019 · 4 comments
Assignees
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: zhouzb
Affected version: OTP-21.0
Fixed in version: OTP-22.1
Component: os_mon
Migrated from: https://bugs.erlang.org/browse/ERL-1012


I am using the [Alpine Erlang Docker Image|https://github.com/erlang/docker-erlang-otp/tree/3765be4573e249004e48a5de9c94127a214b1e6f/21/alpine]. I encountered the problem mentioned in the title, the root cause could be "%Lu" is not supported by Alpine OS.
I fix it by replaceing "%Lu" with "%llu" at in cpu_sup.c:362

{code:c}
    sscanf(buffer, "cpu%u %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
	&(cpu->id),
	&(cpu->user),
	&(cpu->nice_user),
	&(cpu->kernel),
	&(cpu->idle),
	&(cpu->io_wait),
	&(cpu->hard_irq),
	&(cpu->soft_irq),
	&(cpu->steal));

    return cpu;
{code}


@OTP-Maintainer
Copy link
Author

mikael pettersson said:

{{%L}} is a non-standard feature, supported by GNU libc but not e.g. musl.  {{%ll}} is appropriate here (the code is ifdef linux so no need to switch to int64_t and SCNu64).

@OTP-Maintainer
Copy link
Author

zhouzb said:

Could you tell me something about your plan, like when you're going to fix it?

@OTP-Maintainer
Copy link
Author

lukas said:

[~Zhouzb] I've opened a PR with the fix here: https://github.com/erlang/otp/pull/2340

In the future, if a fix is important to you to get fixed it is quicker to just submit a pr yourself.

Thanks for the bug report! The fix should be part of the next maintenance release.

@OTP-Maintainer
Copy link
Author

zhouzb said:

Thank you very match!

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-22.1 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants