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

disclaimtest, weakmaptest or middletest fail in zig build on Linux if enable_gc_debug and enable_redirect_malloc #613

Closed
ivmai opened this issue Jan 12, 2024 · 5 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Jan 12, 2024

Source: master (c0936ed)
Build (disclaimtest): https://github.com/ivmai/bdwgc/actions/runs/7504908429/job/20433003879
Build (middletest): https://github.com/ivmai/bdwgc/actions/runs/7504908429/job/20433004753
Host: Linux/x86_64
Zig version: 0.12.0-dev.2076+8fd15c6ca
Occurrence: sometimes
How to build (disclaimtest): zig build -DBUILD_SHARED_LIBS=false -Denable_gc_assertions -Denable_gc_debug -Denable_redirect_malloc test
How to build (middletest): zig build -DBUILD_SHARED_LIBS=false -Denable_gc_assertions -Denable_gc_debug -Denable_redirect_malloc -Denable_rwlock -Denable_parallel_mark=false test
Output: run disclaimtest failure or run middletest failure

@ivmai ivmai changed the title disclaimtest fail in zig build on Linux if enable_gc_debug and enable_redirect_malloc disclaimtest or middletest fail in zig build on Linux if enable_gc_debug and enable_redirect_malloc Jan 12, 2024
@ivmai
Copy link
Owner Author

ivmai commented Jan 12, 2024

I failed to reproduce it locally (both cases).

@ivmai ivmai changed the title disclaimtest or middletest fail in zig build on Linux if enable_gc_debug and enable_redirect_malloc disclaimtest, weakmaptest or middletest fail in zig build on Linux if enable_gc_debug and enable_redirect_malloc Feb 1, 2024
@ivmai
Copy link
Owner Author

ivmai commented Feb 1, 2024

About weakmap test:
Source: master (3abb17f)
Build: https://github.com/ivmai/bdwgc/actions/runs/7645092432/job/20830884673
Host: Ubuntu/x86_64
How to build and run tests: zig build -DBUILD_SHARED_LIBS=false -Denable_gc_debug=true -Denable_redirect_malloc=true -Denable_gc_assertions=true test

@ivmai
Copy link
Owner Author

ivmai commented Feb 26, 2024

Source: master (c8c9f6d)
Build: https://github.com/ivmai/bdwgc/actions/runs/8052444742/job/21999837427
Failed test: disclaimtest

@ivmai
Copy link
Owner Author

ivmai commented Mar 3, 2024

Probably relates to #288

ivmai added a commit that referenced this issue Mar 19, 2024
Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN() right after GC_store_debug_info_inner() call (instead
of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner): Declare result local
variable.
ivmai added a commit that referenced this issue Mar 19, 2024
Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
@ivmai
Copy link
Owner Author

ivmai commented Mar 19, 2024

Probably fixed. Closing for now.

@ivmai ivmai closed this as completed Mar 19, 2024
ivmai added a commit that referenced this issue Sep 1, 2024
(a cherry-pick of commit f4f943b from 'master')

Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Call ADD_CALL_CHAIN()
right after GC_store_debug_info_inner() call (instead of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Define base local
variable.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
ivmai added a commit that referenced this issue Sep 1, 2024
(a cherry-pick of commit b37ca67 from 'master')

Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
ivmai added a commit that referenced this issue Sep 4, 2024
(a cherry-pick of commit f4f943b from 'master')

Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Call ADD_CALL_CHAIN()
right after GC_store_debug_info_inner() call (instead of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Define base local
variable.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
ivmai added a commit that referenced this issue Sep 4, 2024
(a cherry-pick of commit b37ca67 from 'master')

Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
ivmai added a commit that referenced this issue Sep 5, 2024
(a cherry-pick of commit 70163b7 from 'release-8_0')

Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Call ADD_CALL_CHAIN()
right after GC_store_debug_info_inner() call (instead of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Define base local
variable.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
ivmai added a commit that referenced this issue Sep 5, 2024
(a cherry-pick of commit b37ca67 from 'master')

Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
ivmai added a commit that referenced this issue Sep 5, 2024
(a cherry-pick of commit 70163b7 from 'release-8_0')

Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Call ADD_CALL_CHAIN()
right after GC_store_debug_info_inner() call (instead of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Define base local
variable.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
ivmai added a commit that referenced this issue Sep 5, 2024
(a cherry-pick of commit b37ca67 from 'master')

Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
ivmai added a commit that referenced this issue Sep 6, 2024
(a cherry-pick of commit 36a48ec from 'release-7_4')

Issue #613 (bdwgc).

This might be important for the case of malloc redirection as
backtrace() need to be called without the allocator lock held.

* dbg_mlc.c (store_debug_info, GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Call ADD_CALL_CHAIN()
right after GC_store_debug_info_inner() call (instead of before it).
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page): Define base local
variable.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
ivmai added a commit that referenced this issue Sep 6, 2024
(a cherry-pick of commit 7dd72b5 from 'release-7_4')

Issue #613 (bdwgc).

As backtrace() might call a redirected malloc, we need to release the
allocator lock temporarily before backtrace() call, and we should not
call backtrace() at all for the cases where it is not possible to
release the allocator lock temporarily (i.e. for internal allocations).

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call
ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN().
* include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare
function.
* include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER):
Define.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC
&& THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement.
* os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0
&& NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC]
(GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant