Skip to content

Conversation

@michalmuskala
Copy link
Contributor

In particular, this includes the full original binary and all the references. Gathering this information requires full heap traversal, so is fairly expensive - that's why we keep both the existing binary and this new API.

Example:

1> A = <<0:(1024*8)>>.
2> <<B:550/bitstring,D:550/bits,E:550/bits,C/bitstring>> = A.
3> erlang:process_info(self(),[binary_full]).
[{binary_full,[{126812357133856,1024,1,
           <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...>>,
           [{1100,1650},{550,1100},{1650,8192},{0,550},{0,8192}]}]}]

Original draft implementation by @garazdawi in garazdawi@d5a2c6f.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

CT Test Results

    3 files    135 suites   49m 9s ⏱️
1 651 tests 1 594 ✅ 57 💤 0 ❌
2 287 runs  2 211 ✅ 76 💤 0 ❌

Results for commit 44c22ec.

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

@michalmuskala michalmuskala force-pushed the binary-full branch 5 times, most recently from eb25eca to 1ca8340 Compare October 7, 2025 12:07
In particular, this includes the full original binary and all the references.
Gathering this information requires full heap traversal, so is fairly expensive -
that's why we keep both the existing `binary` and this new API.

Example:

```
1> A = <<0:(1024*8)>>.
2> <<B:550/bitstring,D:550/bits,E:550/bits,C/bitstring>> = A.
3> erlang:process_info(self(),[binary_full]).
[{binary_full,[{126812357133856,1024,1,
           <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...>>,
           [{1100,1650},{550,1100},{1650,8192},{0,550},{0,8192}]}]}]
```

Co-authored-by: Lukas Backström <lukas@erlang.org>
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Oct 13, 2025
@jhogberg jhogberg self-assigned this Oct 13, 2025
Copy link
Contributor

@jhogberg jhogberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've left some comments below.

@michalmuskala
Copy link
Contributor Author

Thank you for the review. I pushed an update addressing your comments.
I also moved the read of the reference count to happen before we bump it, so we don't need to later decrease it.

@jhogberg jhogberg added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Oct 23, 2025
@jhogberg
Copy link
Contributor

We got a few core dumps relating to this, as well as some valgrind/asan issues.

Thread 1 (Thread 0x7f4a45fd8700 (LWP 16829)):
#0  gather_binaries (range_infos=range_infos@entry=0x7f4a45fd2b70, count=count@entry=2, start=, stop=) at beam/erl_gc.c:3860
#1  0x000055830fcb2301 in erts_gather_binaries (hfact=hfact@entry=0x7f4a45fd3a50, rp=rp@entry=0x558311d694c0) at beam/erl_gc.c:3923
#2  0x000055830fb968a2 in process_info_aux (c_p=c_p@entry=0x558311d694c0, hfact=hfact@entry=0x7f4a45fd3a50, rp=rp@entry=0x558311d694c0, rp_locks=rp_locks@entry=1, item_ix=41, extra=extra@entry=0, msgq_len_p=0x7f4a45fd37f0, flags=25, reserve_sizep=0x7f4a45fd39b0, reds=0x7f4a45fd3a48) at beam/erl_bif_info.c:2164
#3  0x000055830fb98f0a in erts_process_info (c_p=c_p@entry=0x558311d694c0, hfact=hfact@entry=0x7f4a45fd3a50, rp=rp@entry=0x558311d694c0, rp_locks=rp_locks@entry=1, item_ix=item_ix@entry=0x7f4a45fd3ac0, item_extra=item_extra@entry=0x0, item_len=1, flags=25, reserve_size=, reds=0x7f4a45fd3a48) at beam/erl_bif_info.c:1111
#4  0x000055830fb9ac4a in process_info_bif (c_p=, pid=, opt=, always_wrap=, pi2=) at beam/erl_bif_info.c:1419
#5  0x000055830faa2f40 in beam_jit_call_bif (c_p=0x558311d694c0, reg=0x7f4a45fd3d80, I=, vbf=, arity=2) at beam/jit/beam_jit_common.cpp:597
#6  0x00007f4a4a9884fa in global::call_bif_shared ()
#7  0x00007f4a4aa12a74 in erts_internal:await_result/1 ()
#8  0x00007f4a4fb187e8 in ?? ()
#9  0x00007f4a4fb187e8 in ?? ()
#10 0x0000000000000000 in ?? ()
 Testcase: process_SUITE:process_info_2_list/1 (14 errors ):

     Error[0x1a69bde]:UninitCondition: erl_gc.c:3854
         Conditional jump or move depends on uninitialised value(s)
         Suspected: gather_binaries:3854 (-> 0x4F8784) [erl_gc.c]
         Stackdump:
             gather_binaries:3854 (-> 0x4F8784) [erl_gc.c]
             erts_gather_binaries:3923 (-> 0x4FF9B1) [erl_gc.c]
             process_info_aux:2164 (-> 0x424347) [erl_bif_info.c]
             erts_process_info:1111 (-> 0x424B1F) [erl_bif_info.c]
             process_info_bif:1419 (-> 0x425F98) [erl_bif_info.c]
             process_info_2:1559 (-> 0x426A1F) [erl_bif_info.c]
             beam_jit_call_bif(process*, unsigned long*, void const*, unsigned long (*)(process*, unsigned long*, void const*), unsigned long):597 (-> 0x33A09F) [beam_jit_common.cpp]
             $global::call_bif_shared+46:??? (-> 0x46D0552E) [JIT code]
             $global::i_breakpoint_trampoline_shared+2B:??? (-> 0x46D06083) [JIT code]
             $erts_internal:await_result/1+63:??? (-> 0x46D9A84B) [JIT code]
             :??? (-> 0x4BE2BD3F) []
             $erts_internal:await_result/1+133:??? (-> 0x46D9A91B) [JIT code]

 Error[0x1a69dce]:UninitValue: erl_gc.c:3852

     Use of uninitialised value of size 8
     Suspected: gather_binaries:3852 (-> 0x4F877B) [erl_gc.c]
     Stackdump:
         gather_binaries:3852 (-> 0x4F877B) [erl_gc.c]
         erts_gather_binaries:3923 (-> 0x4FF9B1) [erl_gc.c]
         process_info_aux:2164 (-> 0x424347) [erl_bif_info.c]
         erts_process_info:1111 (-> 0x424B1F) [erl_bif_info.c]
         process_info_bif:1419 (-> 0x425F98) [erl_bif_info.c]
         process_info_2:1559 (-> 0x426A1F) [erl_bif_info.c]
         beam_jit_call_bif(process*, unsigned long*, void const*, unsigned long (*)(process*, unsigned long*, void const*), unsigned long):597 (-> 0x33A09F) [beam_jit_common.cpp]
         $global::call_bif_shared+46:??? (-> 0x46D0552E) [JIT code]
         $global::i_breakpoint_trampoline_shared+2B:??? (-> 0x46D06083) [JIT code]
         $erts_internal:await_result/1+63:??? (-> 0x46D9A84B) [JIT code]
         :??? (-> 0x4BE2BD3F) []
         $erts_internal:await_result/1+133:??? (-> 0x46D9A91B) [JIT code]

 Error[0x1a6a47f]:UninitCondition: erl_gc.c:3857

     Conditional jump or move depends on uninitialised value(s)
     Suspected: gather_binaries:3857 (-> 0x4F8793) [erl_gc.c]
     Stackdump:
         gather_binaries:3857 (-> 0x4F8793) [erl_gc.c]
         erts_gather_binaries:3923 (-> 0x4FF9B1) [erl_gc.c]
         process_info_aux:2164 (-> 0x424347) [erl_bif_info.c]
         erts_process_info:1141 (-> 0x424BFE) [erl_bif_info.c]
         process_info_bif:1419 (-> 0x425F98) [erl_bif_info.c]
         process_info_2:1559 (-> 0x426A1F) [erl_bif_info.c]
         beam_jit_call_bif(process*, unsigned long*, void const*, unsigned long (*)(process*, unsigned long*, void const*), unsigned long):597 (-> 0x33A09F) [beam_jit_common.cpp]
         $global::call_bif_shared+46:??? (-> 0x46D0552E) [JIT code]
         $global::i_breakpoint_trampoline_shared+2B:??? (-> 0x46D06083) [JIT code]
         $erts_internal:await_result/1+63:??? (-> 0x46D9A84B) [JIT code]
         :??? (-> 0x4BE2BD3F) []
         $erts_internal:await_result/1+133:??? (-> 0x46D9A91B) [JIT code]


 Error[0x1a6a480]:UninitCondition: erl_gc.c:3870

     Conditional jump or move depends on uninitialised value(s)
     Suspected: gather_binaries:3870 (-> 0x4F87A3) [erl_gc.c]
     Stackdump:
         gather_binaries:3870 (-> 0x4F87A3) [erl_gc.c]
         erts_gather_binaries:3923 (-> 0x4FF9B1) [erl_gc.c]
         process_info_aux:2164 (-> 0x424347) [erl_bif_info.c]
         erts_process_info:1141 (-> 0x424BFE) [erl_bif_info.c]
         process_info_bif:1419 (-> 0x425F98) [erl_bif_info.c]
         process_info_2:1559 (-> 0x426A1F) [erl_bif_info.c]
         beam_jit_call_bif(process*, unsigned long*, void const*, unsigned long (*)(process*, unsigned long*, void const*), unsigned long):597 (-> 0x33A09F) [beam_jit_common.cpp]
         $global::call_bif_shared+46:??? (-> 0x46D0552E) [JIT code]
         $global::i_breakpoint_trampoline_shared+2B:??? (-> 0x46D06083) [JIT code]
         $erts_internal:await_result/1+63:??? (-> 0x46D9A84B) [JIT code]
         :??? (-> 0x4BE2BD3F) []
         $erts_internal:await_result/1+133:??? (-> 0x46D9A91B) [JIT code]

 Error[0x1a6a482]:UninitCondition: erl_gc.c:3851

     Conditional jump or move depends on uninitialised value(s)
     Suspected: gather_binaries:3851 (-> 0x4F8775) [erl_gc.c]
     Stackdump:
         gather_binaries:3851 (-> 0x4F8775) [erl_gc.c]
         erts_gather_binaries:3923 (-> 0x4FF9B1) [erl_gc.c]
         process_info_aux:2164 (-> 0x424347) [erl_bif_info.c]
         erts_process_info:1141 (-> 0x424BFE) [erl_bif_info.c]
         process_info_bif:1419 (-> 0x425F98) [erl_bif_info.c]
         process_info_2:1559 (-> 0x426A1F) [erl_bif_info.c]
         beam_jit_call_bif(process*, unsigned long*, void const*, unsigned long (*)(process*, unsigned long*, void const*), unsigned long):597 (-> 0x33A09F) [beam_jit_common.cpp]
         $global::call_bif_shared+46:??? (-> 0x46D0552E) [JIT code]
         $global::i_breakpoint_trampoline_shared+2B:??? (-> 0x46D06083) [JIT code]
         $erts_internal:await_result/1+63:??? (-> 0x46D9A84B) [JIT code]
         :??? (-> 0x4BE2BD3F) []
         $erts_internal:await_result/1+133:??? (-> 0x46D9A91B) [JIT code]

@jhogberg
Copy link
Contributor

jhogberg commented Oct 27, 2025

Core was generated by `/ldisk/daily_build/29_master-opu_o.2025-10-25_21/otp/lib/erlang/erts-16.2/bin/be'.
Program terminated with signal SIGBUS, Bus error.
Object-specific hardware error.
#0  gather_binaries (range_infos=0x871926c80, count=4, start=, stop=0x914f71bd058) at beam/erl_gc.c:3860
3860	                if (thing_subtag(underlying->thing_word) != HEAP_BITS_SUBTAG) {
[Current thread is 1 (LWP 1091786)]
Core was generated by `/ldisk/daily_build/29_master-opu_o_inet_backend.2025-10-24_21/otp/lib/erlang/er'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  gather_binaries (range_infos=range_infos@entry=0x7fcfe5d09b20, count=count@entry=2, start=, stop=0x7fcfa25db2f8) at beam/erl_gc.c:3860
3860	                if (thing_subtag(underlying->thing_word) != HEAP_BITS_SUBTAG) {
[Current thread is 1 (Thread 0x7fcfe5d0f6c0 (LWP 954920))]

@michalmuskala
Copy link
Contributor Author

Thanks, I'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:VM Assigned to OTP team VM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants