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

cover: Gracefully handle failures to collect coverage data #8742

Merged

Conversation

bjorng
Copy link
Contributor

@bjorng bjorng commented Aug 23, 2024

On platforms that support native coverage (introduced in Erlang/OTP 27), the cover module did not properly handle failed calls to code:get_coverage/2. The call to that function will fail if the module in question has been reloaded or unloaded.

For example, if cover:export/1 was called and a module had been reloaded on a remote node (for example by meck), the cover:export/1 call would never return.

Because the current API for cover has no good way to report this kind of error, we will fix the issue by logging the failed call using the logger module and otherwise ignore the failure. That implies that there will be no coverage information for modules that have been reloaded. That is compatible with the behavior of cover prior to Erlang/OTP 27.

Closes #8691

On platforms that support native coverage (introduced in
Erlang/OTP 27), the `cover` module did not properly handle failed
calls to `code:get_coverage/2`. The call to that function will fail
if the module in question has been reloaded or unloaded.

For example, if `cover:export/1` was called and a module had been
reloaded on a remote node (for example by `meck`), the
`cover:export/1` call would never return.

Because the current API for `cover` has no good way to report this
kind of error, we will fix the issue by logging the failed call using
the `logger` module and otherwise ignore the failure. That implies
that there will be no coverage information for modules that have been
reloaded. That is compatible with the behavior of `cover` prior to
Erlang/OTP 27.

Closes erlang#8691
@bjorng bjorng added team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI bug Issue is reported as a bug labels Aug 23, 2024
@bjorng bjorng requested a review from garazdawi August 23, 2024 07:18
@bjorng bjorng self-assigned this Aug 23, 2024
@bjorng bjorng linked an issue Aug 23, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Aug 23, 2024

CT Test Results

  2 files   22 suites   6m 14s ⏱️
222 tests 219 ✅ 3 💤 0 ❌
248 runs  245 ✅ 3 💤 0 ❌

Results for commit 426c582.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@bjorng bjorng merged commit fd5a0d5 into erlang:maint Aug 28, 2024
17 checks passed
@bjorng bjorng deleted the bjorn/tools/fix-cover-hang/GH-8661/OTP-19203 branch August 28, 2024 10:56
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 team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cover:export/1 never returns in Erlang 27
1 participant