| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard size) of the current thread. Check if pthread_attr_get_np() function and <pthread_np.h> header are available in configure.
|
Sadly, I added the new HAVE_PTHREAD_NP_H macro to Tools/build/check_capi_macros_ignored.txt. I don't know how to check if a header is available in configure and define a macro name different than HAVE_<header>_H. I asked on #157696 (comment) if there is a way to define a _Py_HAVE_xxx_H macro instead. |
Sorry, something went wrong.
|
Without this change, test_lazy_import.test_deeply_dotted_name() does crash with SIGILL on FreeBSD, see: #159535. With this change, the test pass as expected (I tested FreeBSD 16): $ ./python -m test test_lazy_import -v -m test_deeply_dotted_name == CPython 3.16.0a1+dev (heads/pr/159604:c031a553097, Oct 17 2026, 02:48:37) [Clang 21.1.8 (https://github.com/llvm/llvm-project.git llvmorg-21.1.8-0-g2078da == FreeBSD-16.0-CURRENT-amd64-64bit-ELF little-endian == Python build: debug (...) test_deeply_dotted_name (test.test_lazy_import.LazyImportTypeTests.test_deeply_dotted_name) A long dotted name must not overflow the C stack. ... ok (...) Result: SUCCESS |
Sorry, something went wrong.
|
!buildbot FreeBSD16 |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit c031a55 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F159604%2Fmerge The command will test the builders whose names match following regular expression: FreeBSD16 The builders matched are:
|
Sorry, something went wrong.
I created #159612 for this unrelated failure. |
Sorry, something went wrong.
|
test_json fails on FreeBSD 16, the failure seems to be related: FAIL: test_highly_nested_objects_encoding (test.test_json.test_recursion.TestCRecursion.test_highly_nested_objects_encoding)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/buildbot/buildarea/pull_request.opsec-fbsd16/build/Lib/test/test_json/test_recursion.py", line 98, in test_highly_nested_objects_encoding
with self.assertRaises(RecursionError):
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: RecursionError not raised
|
Sorry, something went wrong.
On FreeBSD 16 with a default stack size of 512 MB, the json C implementation no longer raises RecursionError in test_highly_nested_objects_encoding(). Reduce max_depth from 5_000 to 2_000 so test_highly_nested_objects_encoding() of the Python implementation only takes 1.6 seconds, instead of 12 seconds.
|
!buildbot FreeBSD |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 120fce0 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F159604%2Fmerge The command will test the builders whose names match following regular expression: FreeBSD The builders matched are:
|
Sorry, something went wrong.
| void *stack_addr; | ||
| pthread_attr_t attr; | ||
| #ifdef _Py_HAVE_PTHREAD_ATTR_GET_NP | ||
| int err = pthread_attr_init(&attr); |
There was a problem hiding this comment.
It is already called here; is it safe to call here again?
Sorry, something went wrong.
There was a problem hiding this comment.
pthread_attr_init() should be called every time you allocate a new pthread_attr_t attr on the stack memory: https://www.man7.org/linux/man-pages/man3/pthread_attr_init.3.html. Here the strange part is that the pthread_getattr_np() code path doesn't call pthread_attr_init(), but it calls pthread_attr_destroy().
At least, I can say that calling pthread_getattr_np() on a fresh pthread_attr_t attr variable without calling pthread_attr_init() fails on FreeBSD. So I had to add pthread_attr_init() call.
Sorry, something went wrong.
There was a problem hiding this comment.
I wrote a follow-up PR #159857 to also call pthread_attr_init() on Linux.
Sorry, something went wrong.
Good: the test suite passed on the 6 FreeBSD buildbots. |
Sorry, something went wrong.
|
GH-159928 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
…9928) gh-159603: Use pthread_attr_get_np() on FreeBSD (#159604) Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard size) of the current thread. Check if pthread_attr_get_np() function and <pthread_np.h> header are available in configure. Update test_json.test_recursion. On FreeBSD 16 with a default stack size of 512 MB, the json C implementation no longer raises RecursionError in test_highly_nested_objects_encoding(). Reduce also max_depth from 5,000 to 2,000 so test_highly_nested_objects_encoding() of the Python implementation only takes 1.6 seconds, instead of 12 seconds. (cherry picked from commit 71ba39d)
| Back | FazBrowse Home | New Git URL |
Use pthread_attr_get_np() on FreeBSD to get the stack size (and guard size) of the current thread.
Check if pthread_attr_get_np() function and <pthread_np.h> header are available in configure.