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

Add stacktrace in max heap size log #7592

Merged
merged 3 commits into from
Sep 28, 2023
Merged

Add stacktrace in max heap size log #7592

merged 3 commits into from
Sep 28, 2023

Conversation

zzydxm
Copy link
Contributor

@zzydxm zzydxm commented Aug 25, 2023

This commit externs the current_stacktrace function and use it in erl_gc when doing max heap event log. This is especially useful when debugging a process that has been killed by the heap limit.

I'm not sure if this is the right way doing it, but here is how it will look like:

./bin/erl +hmax 1000000
Erlang/OTP 27 [DEVELOPMENT] [erts-14.0.2] [source-05c52ba036] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Eshell V14.0.2 (press Ctrl+G to abort, type help(). for help)
1> lists:seq(1,1000000).
=ERROR REPORT==== 25-Aug-2023::14:41:56.256793 ===
     Process:            <0.85.0>
     Context:            maximum heap size reached
     Max Heap Size:      1000000
     Total Heap Size:    1029719
     Kill:               true
     Error Logger:       true
     Message Queue Len:  0
     GC Info:            [{old_heap_block_size,318187},
                          {heap_block_size,711488},
                          {mbuf_size,0},
                          {recent_size,150168},
                          {stack_size,26},
                          {old_heap_size,196624},
                          {heap_size,196616},
                          {bin_vheap_size,0},
                          {bin_vheap_block_size,46422},
                          {bin_old_vheap_size,8},
                          {bin_old_vheap_block_size,46422}]
     Stacktrace:         [{erl_eval,do_apply,7,
                                    [{file,"erl_eval.erl"},{line,750}]},
                          {shell,exprs,7,[{file,"shell.erl"},{line,780}]},
                          {shell,eval_exprs,7,[{file,"shell.erl"},{line,736}]},
                          {shell,eval_loop,4,[{file,"shell.erl"},{line,721}]}]

** exception exit: killed
2>

This commit externs the current_stacktrace function and use it in erl_gc
when doing max heap event log. This is especially useful when debugging
a process that has been killed by the heap limit.
@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2023

CT Test Results

       3 files     133 suites   47m 53s ⏱️
1 560 tests 1 504 ✔️ 54 💤 2
1 983 runs  1 908 ✔️ 73 💤 2

For more details on these failures, see this check.

Results for commit e19c378.

♻️ 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

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Aug 28, 2023
@zzydxm
Copy link
Contributor Author

zzydxm commented Aug 28, 2023

Hmmm could anyone point out which test SUITE does the code fail? I can't figure it out from the CI log and I don't see anything fail in my local make test.

@sverker
Copy link
Contributor

sverker commented Aug 29, 2023

Hmmm could anyone point out which test SUITE does the code fail? I can't figure it out from the CI log and I don't see anything fail in my local make test.

Click on "Complete CT logs" above. Click on "emulator_test" which have two failed tests. Click on the "Result" column and you will get the two failed tests sorted first.
But I don't see how they would be caused by this PR.

when max_heap_size has been reached.
Not sure it would be a problem but it seem like it could be.
@sverker
Copy link
Contributor

sverker commented Aug 29, 2023

I added two commits. Basically to avoid building the stack trace on the process heap. I'm not sure but it may be problematic when we have reached max_heap_size.

@zzydxm
Copy link
Contributor Author

zzydxm commented Aug 29, 2023

Thanks for the suggestions! It looks good to me.

Are the failing tests otp_17127_local_link_with_simultaneous_link_unlink and otp_17127_local_random? They both worked on my laptop (m1 macbook). Is there anything I can do here?

@sverker
Copy link
Contributor

sverker commented Aug 30, 2023

Are the failing tests otp_17127_local_link_with_simultaneous_link_unlink and otp_17127_local_random? They both worked on my laptop (m1 macbook). Is there anything I can do here?

Yes, those are the failing ones. It's due to a bug on master branch.

@sverker sverker added feature testing currently being tested, tag is used by OTP internal CI labels Sep 21, 2023
@sverker sverker merged commit f8add54 into erlang:master Sep 28, 2023
27 of 31 checks passed
@sverker
Copy link
Contributor

sverker commented Sep 28, 2023

Merged to master.
@zzydxm Thanks for the contribution. But for next time, please try give your branch a more descriptive name. It makes our administration easier.

@sverker sverker removed the testing currently being tested, tag is used by OTP internal CI label Sep 28, 2023
@zzydxm
Copy link
Contributor Author

zzydxm commented Oct 2, 2023

Sure, will do. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants