Skip to content

test_capi crash and produce core dumps on FreeBSD 13 #106714

Closed

Description

@vstinner

Examples:

[vstinner@freebsd ~/python/main]$ ./python -m test test_capi -m test_no_FatalError_infinite_loop -v
...
Warning -- files was modified by test_capi
Warning --   Before: []
Warning --   After:  ['python.core'] 

and

[vstinner@freebsd ~/python/main]$ ./python -m test -v test_capi -m test_get_set_optimizer 
...
test_get_set_optimizer (test.test_capi.test_misc.TestOptimizerAPI.test_get_set_optimizer) ... Fatal Python error: Segmentation fault

Current thread 0x0000000827265000 (most recent call first):
  File "/usr/home/vstinner/python/main/Lib/unittest/case.py", line 589 in _callTestMethod
  File "/usr/home/vstinner/python/main/Lib/unittest/case.py", line 634 in run
  File "/usr/home/vstinner/python/main/Lib/unittest/case.py", line 690 in __call__
  File "/usr/home/vstinner/python/main/Lib/unittest/suite.py", line 122 in run
  • FreeBSD 13.2-RELEASE-p1
  • clang 14.0.5
  • Python configured with: ./configure --cache-file=../config.cache --with-pydebug CFLAGS="-O0"

Linked PRs

Activity

  1. vstinner commented on Jul 22, 2023

    @vstinner
    MemberAuthor

    Oh, AArch64 Fedora Rawhide buildbot has the same failure: it also produces a coredump.

    This issue affects operating systems configured to write a coredump in the current directory if a process does crash. Example on the AArch64 Fedora Rawhide machine:

    $ cat /proc/sys/kernel/core_pattern 
    [vstinner@python-builder-fedora-rawhide-aarch64 ~]$ file /proc/sys/kernel/core_pattern 
    /proc/sys/kernel/core_pattern: empty
    [vstinner@python-builder-fedora-rawhide-aarch64 test]$ cat /proc/sys/kernel/core_uses_pid 
    1
    
    [vstinner@python-builder-fedora-rawhide-aarch64 test]$ ulimit -c
    unlimited
    
    [vstinner@python-builder-fedora-rawhide-aarch64 ~]$ mkdir test
    [vstinner@python-builder-fedora-rawhide-aarch64 ~]$ cd test
    [vstinner@python-builder-fedora-rawhide-aarch64 test]$ python
    Python 3.11.3 (main, Apr  5 2023, 00:00:00) [GCC 13.0.1 20230404 (Red Hat 13.0.1-0)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ctypes
    >>> ctypes.string_at(0)
    Segmentation fault (core dumped)
    
    [vstinner@python-builder-fedora-rawhide-aarch64 test]$ ls -la
    (...)
    -rw-------.  1 vstinner vstinner 9465856 Jul 22 13:45 .2755244
    

    A core dump named .2755244 was created in the current directory.

  2. added 2 commits that reference this issue on Jul 22, 2023
  3. added a commit that references this issue on Jul 22, 2023
  4. vstinner commented on Jul 22, 2023

    @vstinner
    MemberAuthor

    Oh, this bug is a recent regression introduced by #102729

  5. vstinner commented on Jul 22, 2023

    @vstinner
    MemberAuthor

    Python 3.11 is not affected:

        @support.requires_subprocess()
        def test_no_FatalError_infinite_loop(self):
            with support.SuppressCrashReport():
                p = subprocess.Popen([sys.executable, "-c",
                                      'import _testcapi;'
                                      '_testcapi.crash_no_current_thread()'],
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE)
            (out, err) = p.communicate()
  6. added a commit that references this issue on Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions