A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ocaml/ocaml/issues/11425 below:

Test triggering infinite loop in caml_scan_stack on arm64 · Issue #11425 · ocaml/ocaml · GitHub

We are observing an issue with a property-based test triggering an apparent infinite loop on arm64 (5.0.0~alpha0 and 5.1.0+trunk)
while amd64 completes the test as expected.

Consider the property-based test in https://github.com/jmid/multicoretests/tree/bytes located in file src/bytes/lin_tests.ml
Starting from a Bytes of size 42, this repeats 1000 times a test of the following form:

                                      |
                      Bytes.get t 4082802875569992363
                      Bytes.get t -2858709553352776116
                      Bytes.get t 1363109893947027853
                      Bytes.get t 2947451885998816648
                                      |
                   .------------------------------------.
                   |                                    |
    Bytes.get t 489138274756058094       Bytes.get t 4420947024389089565
                   |                     Bytes.get t -1978859559514483936
                   |                                    |

I just did a little experiment:

We are observing the same behaviour with OCaml version 5.0.0~alpha0 and latest 5.1.0+trunk.

perf top reveals that the test is spending most its time in caml_scan_stack:

  92.86%  lin_tests.exe                           [.] caml_scan_stack
   0.23%  [kernel]                                [k] _raw_spin_unlock_irq
   0.22%  [kernel]                                [k] clear_page
   0.21%  perf_5.10                               [.] 0x00000000000f846c
   0.20%  libc-2.31.so                            [.] __aarch64_swp4_rel
   0.19%  [kernel]                                [k] kallsyms_expand_symbol.constprop.7
   0.16%  perf_5.10                               [.] 0x00000000001024d4
   0.16%  [kernel]                                [k] _raw_spin_unlock_irqrestore
   0.14%  [kernel]                                [k] vsnprintf
   0.13%  [kernel]                                [k] module_get_kallsym
   0.12%  [kernel]                                [k] el0_svc_common.constprop.3
   0.12%  [kernel]                                [k] format_decode
   0.11%  ld-2.31.so                              [.] do_lookup_x
   0.10%  libc-2.31.so                            [.] _int_malloc
   0.10%  [kernel]                                [k] number
   0.10%  [kernel]                                [k] string_nocheck
   0.09%  libc-2.31.so                            [.] __GI___memset_generic
   0.09%  libc-2.31.so                            [.] strchr
   0.08%  [kernel]                                [k] get_page_from_freelist
   0.07%  libc-2.31.so                            [.] __libc_calloc
   0.07%  [kernel]                                [k] el0_da
   0.07%  [kernel]                                [k] __arch_copy_to_user
   0.06%  perf_5.10                               [.] 0x00000000001024ec
   0.05%  libc-2.31.so                            [.] __mprotect
   0.05%  libelf-0.183.so                         [.] gelf_getsym
   0.05%  [kernel]                                [k] memcpy
   0.05%  libc-2.31.so                            [.] strcmp
   0.05%  libc-2.31.so                            [.] __memcpy_generic
   0.05%  libc-2.31.so                            [.] sysmalloc
   0.04%  ld-2.31.so                              [.] _dl_lookup_symbol_x
   0.04%  [kernel]                                [k] preempt_count_add
   0.04%  libc-2.31.so                            [.] __aarch64_cas4_acq
   0.04%  libc-2.31.so                            [.] strrchr
   0.04%  libslang.so.2.3.2                       [.] SLsmg_write_chars
   0.03%  ld-2.31.so                              [.] _dl_relocate_object
   0.03%  libc-2.31.so                            [.] __strlen_generic
   0.03%  perf_5.10                               [.] 0x0000000000102a0c
   0.03%  [kernel]                                [k] ___bpf_prog_run
   0.03%  [kernel]                                [k] preempt_count_sub
   0.03%  perf_5.10                               [.] 0x00000000001024e4
   0.03%  [kernel]                                [k] generic_file_write_iter
   0.03%  perf_5.10                               [.] 0x00000000000ed124
   0.03%  [kernel]                                [k] prep_new_page
   0.03%  [kernel]                                [k] handle_mm_fault
   0.03%  libc-2.31.so                            [.] __aarch64_cas8_rel

Here's the perf report for a folded run where I interrupted the run after a while:

$ perf report --stdio -n -g folded
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 230K of event 'cycles:u'
# Event count (approx.): 94799659549
#
# Children      Self       Samples  Command        Shared Object       Symbol                                                                                    
# ........  ........  ............  .............  ..................  ..........................................................................................
#
    99.31%     0.02%           116  lin_tests.exe  lin_tests.exe       [.] stw_handler
98.87% stw_handler;caml_stw_empty_minor_heap;caml_stw_empty_minor_heap_no_major_slice.constprop.0;caml_empty_minor_heap_promote;caml_scan_stack
    99.01%     0.00%             3  lin_tests.exe  lin_tests.exe       [.] caml_stw_empty_minor_heap
98.87% caml_stw_empty_minor_heap;caml_stw_empty_minor_heap_no_major_slice.constprop.0;caml_empty_minor_heap_promote;caml_scan_stack
    99.00%     0.01%            36  lin_tests.exe  lin_tests.exe       [.] caml_stw_empty_minor_heap_no_major_slice.constprop.0
98.87% caml_stw_empty_minor_heap_no_major_slice.constprop.0;caml_empty_minor_heap_promote;caml_scan_stack
    98.97%     0.01%            24  lin_tests.exe  lin_tests.exe       [.] caml_empty_minor_heap_promote
98.87% caml_empty_minor_heap_promote;caml_scan_stack
    98.91%     0.02%           186  lin_tests.exe  lin_tests.exe       [.] caml_c_call
98.87% caml_c_call;caml_array_bound_error;caml_raise;caml_process_pending_actions_with_root_exn;caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml>
    98.87%    98.87%        212408  lin_tests.exe  lin_tests.exe       [.] caml_scan_stack
98.87% caml_c_call;caml_array_bound_error;caml_raise;caml_process_pending_actions_with_root_exn;caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml>
    98.87%     0.00%             0  lin_tests.exe  lin_tests.exe       [.] caml_do_pending_actions_exn
98.87% caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml_stw_empty_minor_heap;caml_stw_empty_minor_heap_no_major_slice.constprop.0;caml_empty_min>
    98.87%     0.00%             0  lin_tests.exe  lin_tests.exe       [.] caml_handle_gc_interrupt
98.87% caml_handle_gc_interrupt;stw_handler;caml_stw_empty_minor_heap;caml_stw_empty_minor_heap_no_major_slice.constprop.0;caml_empty_minor_heap_promote;caml_scan_st>
    98.87%     0.00%             1  lin_tests.exe  lin_tests.exe       [.] caml_process_pending_actions_with_root_exn
98.87% caml_process_pending_actions_with_root_exn;caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml_stw_empty_minor_heap;caml_stw_empty_minor_hea>
    98.87%     0.00%             4  lin_tests.exe  lin_tests.exe       [.] caml_array_bound_error
98.87% caml_array_bound_error;caml_raise;caml_process_pending_actions_with_root_exn;caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml_stw_empty_m>
    98.87%     0.00%             4  lin_tests.exe  lin_tests.exe       [.] caml_raise
98.87% caml_raise;caml_process_pending_actions_with_root_exn;caml_do_pending_actions_exn;caml_handle_gc_interrupt;stw_handler;caml_stw_empty_minor_heap;caml_stw_empt>
     0.80%     0.00%          1870  lin_tests.exe  libc-2.31.so        [.] thread_start
     0.80%     0.00%          4931  lin_tests.exe  libpthread-2.31.so  [.] start_thread
     0.43%     0.00%           352  lin_tests.exe  lin_tests.exe       [.] backup_thread_func
     0.36%     0.00%           534  lin_tests.exe  lin_tests.exe       [.] domain_thread_func
     0.34%     0.01%            46  lin_tests.exe  lin_tests.exe       [.] major_collection_slice
     0.31%     0.02%            64  lin_tests.exe  lin_tests.exe       [.] caml_empty_minor_heaps_once
     0.26%     0.09%           430  lin_tests.exe  lin_tests.exe       [.] caml_try_run_on_all_domains_with_spin_work
     0.25%     0.25%           895  lin_tests.exe  lin_tests.exe       [.] pool_sweep
     0.25%     0.00%             3  lin_tests.exe  lin_tests.exe       [.] caml_sweep
     0.11%     0.11%           339  lin_tests.exe  lin_tests.exe       [.] caml_gc_log
     0.08%     0.03%           223  lin_tests.exe  lin_tests.exe       [.] camlLin__fun_2177
     0.08%     0.00%             0  lin_tests.exe  [unknown]           [.] 0x0100000000000005
     0.08%     0.01%            43  lin_tests.exe  lin_tests.exe       [.] oldify_one
     0.06%     0.00%             0  dune           dune                [.] caml_poll_gc_work

To recreate:

 git clone -b bytes https://github.com/jmid/multicoretests.git
 opam update
 opam install qcheck
 dune exec -- src/bytes/lin_tests.exe -v

This issue was first reported by @naomiiiiiiiii


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4