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

gh-111569: Implement Python critical section API #111571

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Oct 31, 2023

Critical sections are helpers to replace the global interpreter lock with finer grained locking. They provide similar guarantees to the GIL and avoid the deadlock risk that plain locking involves. Critical sections are implicitly ended whenever the GIL would be released. They are resumed when the GIL would be acquired. Nested critical sections behave as if the sections were interleaved.

Critical sections are helpers to replace the global interpreter lock
with finer grained locking. They provide similar guarantees to the GIL
and avoid the deadlock risk that plain locking involves. Critical
sections are implicitly ended whenever the GIL would be released. They
are resumed when the GIL would be acquired. Nested critical sections
behave as if the sections were interleaved.
@colesbury colesbury added 3.13 bugs and security fixes topic-free-threading labels Oct 31, 2023
@colesbury colesbury marked this pull request as ready for review October 31, 2023 20:08
@colesbury colesbury requested a review from a team as a code owner October 31, 2023 20:08
@colesbury
Copy link
Contributor Author

@ericsnowcurrently I'd appreciate your review if you have time to look at this. This builds off of the PyMutex changes to provide helpers for per-object locking that avoids deadlocks. However, unlike the locking APIs, I don't think this will be useful outside of the --disable-gil builds.

};
assert(test_data.obj1 != NULL);
assert(test_data.obj2 != NULL);
assert(test_data.obj3 != NULL);
Copy link
Member

Choose a reason for hiding this comment

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

Just a drive-by comment, I would much prefer to have conditional returns from native test functions than asserts. When these fail, they can block test progress (on Windows it pops up a modal dialog by default), or may trigger error reporting or a debugger. It also shows up as a test crash, rather than a failure.

Perhaps a new macro is needed to print location information to the console and then fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that the failure case is unpleasant, but I don't think trying to route proper error returns in the C API tests is worthwhile. To the extent that there are bugs in the tested code, they are likely to show up as crashes, deadlocks, or other unpleasant behavior even if we make the asserts more nicely behaved (because this is testing C code, not Python). Additionally, it's challenging to route error messages from other threads in C since they don't always have a GIL context and might not be able to create Python error objects.

One consequence of this is that I think we should basically have a zero tolerance for flaky C API tests. If we are going to be bothered by an unpleasant failure, it better signify something important.

If crashes in the C API tests become an actual problem, then I think it would be better to invest in running these tests in a subprocess like we do with test_support.script_helper.assert_python_failure.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's reasonable. I'm mostly annoyed about it because some versions of MSVC have a compiler bug on ARM64 that causes some of the interlocked tests to fail, which means the entire test run is basically useless until all the machines get updated (as far as I can tell, the code is only ever tested and never actually used, so it doesn't need fixing for our releases - there's nothing we can do about it on our side anyway).

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

At its conceptual core this is a relatively straight-forward addition (inasmuch as anything thread-related can be 😄). I've left comments for a few typos, some minor readability issues, and in places where I'd like some clarification.

In particular, how is reentrancy handled?

I'm also especially curious about critical sections involving many objects, not just one or two. See my comment in pycore_critical_section.h, line 45.

FWIW, it's also nice to see how a lot of the code paths you are adding gets exercised on regular builds (even if the fundamental logic is skipped there). That certainly gives me more confidence about maintainability. 😄

Modules/_testinternalcapi/test_critical_sections.c Outdated Show resolved Hide resolved
Modules/_testinternalcapi/test_critical_sections.c Outdated Show resolved Hide resolved
Modules/_testinternalcapi/test_critical_sections.c Outdated Show resolved Hide resolved
Modules/_testinternalcapi/test_critical_sections.c Outdated Show resolved Hide resolved
Include/object.h Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Show resolved Hide resolved
Include/internal/pycore_critical_section.h Show resolved Hide resolved
Include/cpython/pystate.h Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Nov 3, 2023

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

Copy link
Contributor Author

@colesbury colesbury 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 reviewing this Eric.

In particular, how is reentrancy handled?

Reentrancy is handled implicitly. Basically, if a thread tries to Py_BEGIN_CRITICAL_SECTION the same object, it would block, calling _PyThreadState_Detach(), which suspends the outer critical section and unlocks the object, allowing the most recent Py_BEGIN_CRITICAL_SECTION to continue. We may want to handle this case more explicitly in the future for better efficiency.

I'm also especially curious about critical sections involving many objects, not just one or two.

This doesn't provide an API for locking more than two objects at at once. That hasn't been necessary in the nogil forks. (We could implement it, but my feeling is that if we have a design that wants to lock N objects simultaneously, we probably want to rethink that design.)

Include/internal/pycore_critical_section.h Show resolved Hide resolved
Include/object.h Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/cpython/pystate.h Show resolved Hide resolved
@colesbury
Copy link
Contributor Author

I have made the requested changes; please review again

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. I just have some suggestions about wording/spelling in your big comment.

BTW, thanks for updating that comment. It's much clearer now.

Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
Include/internal/pycore_critical_section.h Outdated Show resolved Hide resolved
@colesbury
Copy link
Contributor Author

Thanks @ericsnowcurrently. I've updated the comments.

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

LGTM

@ericsnowcurrently ericsnowcurrently merged commit 31c90d5 into python:main Nov 8, 2023
28 of 29 checks passed
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot wasm32-emscripten node (dynamic linking) 3.x has failed when building commit 31c90d5.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1056/builds/3542) and take a look at the build logs.
  4. Check if the failure is related to this commit (31c90d5) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1056/builds/3542

Failed tests:

  • test_capi

Summary of the results of the build (if available):

==

Click to see traceback logs
Note: switching to '31c90d5838e8d6e4c47d98500a34810ccb33a6d4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 31c90d5838 gh-111569: Implement Python critical section API (gh-111571)
Switched to and reset branch 'main'

configure: ../../configure --prefix $(PWD)/target/host --with-pydebug --without-pydebug --with-emscripten-target=node --enable-wasm-dynamic-linking --disable-wasm-pthreads --build=x86_64-pc-linux-gnu --host=wasm32-unknown-emscripten --with-build-python=../build/python
configure: WARNING: using cross tools not prefixed with host triplet
mcc: error: no input files

make: make -j2 all
../../Python/ceval_gil.c:429:1: warning: unused function 'current_thread_holds_gil' [-Wunused-function]
current_thread_holds_gil(struct _gil_runtime_state *gil, PyThreadState *tstate)
^
1 warning generated.
../../Python/initconfig.c:2374:27: warning: format specifies type 'wint_t' (aka 'int') but the argument has type 'wint_t' (aka 'unsigned int') [-Wformat]
    printf(usage_envvars, (wint_t)DELIM, (wint_t)DELIM, PYTHONHOMEHELP);
           ~~~~~~~~~~~~~  ^~~~~~~~~~~~~
../../Python/initconfig.c:258:18: note: format string is defined here
"PYTHONPATH   : '%lc'-separated list of directories prefixed to the\n"
                 ^~~
                 %c
../../Python/initconfig.c:2374:42: warning: format specifies type 'wint_t' (aka 'int') but the argument has type 'wint_t' (aka 'unsigned int') [-Wformat]
    printf(usage_envvars, (wint_t)DELIM, (wint_t)DELIM, PYTHONHOMEHELP);
           ~~~~~~~~~~~~~                 ^~~~~~~~~~~~~
../../Python/initconfig.c:260:58: note: format string is defined here
"PYTHONHOME   : alternate <prefix> directory (or <prefix>%lc<exec_prefix>).\n"
                                                         ^~~
                                                         %c
2 warnings generated.
../../Python/optimizer.c:414:9: warning: variable 'reserved' set but not used [-Wunused-but-set-variable]
    int reserved = 0;
        ^
1 warning generated.
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:83:11: warning: 'htobe16' macro redefined [-Wmacro-redefined]
#  define htobe16(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:35:9: note: previous definition is here
#define htobe16(x) __bswap16(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:84:11: warning: 'htole16' macro redefined [-Wmacro-redefined]
#  define htole16(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:41:9: note: previous definition is here
#define htole16(x) (uint16_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:85:11: warning: 'be16toh' macro redefined [-Wmacro-redefined]
#  define be16toh(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:36:9: note: previous definition is here
#define be16toh(x) __bswap16(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:86:11: warning: 'le16toh' macro redefined [-Wmacro-redefined]
#  define le16toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:42:9: note: previous definition is here
#define le16toh(x) (uint16_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:88:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:89:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:90:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:91:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:93:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:94:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:95:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:96:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
12 warnings generated.
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:83:11: warning: 'htobe16' macro redefined [-Wmacro-redefined]
#  define htobe16(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:35:9: note: previous definition is here
#define htobe16(x) __bswap16(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:84:11: warning: 'htole16' macro redefined [-Wmacro-redefined]
#  define htole16(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:41:9: note: previous definition is here
#define htole16(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:85:11: warning: 'be16toh' macro redefined [-Wmacro-redefined]
#  define be16toh(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:36:9: note: previous definition is here
#define be16toh(x) __bswap16(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:86:11: warning: 'le16toh' macro redefined [-Wmacro-redefined]
#  define le16toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:42:9: note: previous definition is here
#define le16toh(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:88:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:89:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:90:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:91:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:93:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:94:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:95:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:96:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
12 warnings generated.
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:83:11: warning: 'htobe16' macro redefined [-Wmacro-redefined]
#  define htobe16(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:35:9: note: previous definition is here
#define htobe16(x) __bswap16(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:84:11: warning: 'htole16' macro redefined [-Wmacro-redefined]
#  define htole16(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:41:9: note: previous definition is here
#define htole16(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:85:11: warning: 'be16toh' macro redefined [-Wmacro-redefined]
#  define be16toh(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:36:9: note: previous definition is here
#define be16toh(x) __bswap16(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:86:11: warning: 'le16toh' macro redefined [-Wmacro-redefined]
#  define le16toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:42:9: note: previous definition is here
#define le16toh(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:88:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:89:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:90:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:91:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:93:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:94:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:95:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:96:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
12 warnings generated.
../../Modules/expat/xmlparse.c:3116:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:3115:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:4059:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:4058:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:7703:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
          bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
          ^~~~~~~~~
3 warnings generated.
../../Modules/socketmodule.c:4081:33: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
         cmsgh != NULL; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
                                ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/buildbot/.emscripten_cache/sysroot/include/sys/socket.h:356:44: note: expanded from macro 'CMSG_NXTHDR'
        __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Modules/socketmodule.c:4134:33: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
         cmsgh != NULL; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
                                ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/buildbot/.emscripten_cache/sysroot/include/sys/socket.h:356:44: note: expanded from macro 'CMSG_NXTHDR'
        __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Modules/socketmodule.c:4758:54: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
            cmsgh = (i == 0) ? CMSG_FIRSTHDR(&msg) : CMSG_NXTHDR(&msg, cmsgh);
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/buildbot/.emscripten_cache/sysroot/include/sys/socket.h:356:44: note: expanded from macro 'CMSG_NXTHDR'
        __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
../../Modules/_sqlite/connection.c:2261:19: warning: result of comparison of constant 9223372036854775807 with expression of type 'Py_ssize_t' (aka 'long') is always false [-Wtautological-constant-out-of-range-compare]
    if (data->len > 9223372036854775807) {  // (1 << 63) - 1
        ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:83:11: warning: 'htobe16' macro redefined [-Wmacro-redefined]
#  define htobe16(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:35:9: note: previous definition is here
#define htobe16(x) __bswap16(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:84:11: warning: 'htole16' macro redefined [-Wmacro-redefined]
#  define htole16(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:41:9: note: previous definition is here
#define htole16(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:85:11: warning: 'be16toh' macro redefined [-Wmacro-redefined]
#  define be16toh(x) __builtin_bswap16(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:36:9: note: previous definition is here
#define be16toh(x) __bswap16(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:86:11: warning: 'le16toh' macro redefined [-Wmacro-redefined]
#  define le16toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:42:9: note: previous definition is here
#define le16toh(x) (uint16_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:88:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:89:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:90:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) __builtin_bswap32(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:91:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:93:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:94:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:95:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) __builtin_bswap64(x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:96:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/buildbot/.emscripten_cache/sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
12 warnings generated.

Kill <WorkerThread #2 running test=test_capi pid=552477 time=25 min> process group
make: *** [Makefile:2048: buildbottest] Error 2

Cannot open file '/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.emscripten-node-dl/build/build/build_oot/host/test-results.xml' for upload

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot wasm32-wasi 3.x has failed when building commit 31c90d5.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1046/builds/3456) and take a look at the build logs.
  4. Check if the failure is related to this commit (31c90d5) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1046/builds/3456

Failed tests:

  • test_capi

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 33, done.        
remote: Counting objects:   3% (1/27)        
remote: Counting objects:   7% (2/27)        
remote: Counting objects:  11% (3/27)        
remote: Counting objects:  14% (4/27)        
remote: Counting objects:  18% (5/27)        
remote: Counting objects:  22% (6/27)        
remote: Counting objects:  25% (7/27)        
remote: Counting objects:  29% (8/27)        
remote: Counting objects:  33% (9/27)        
remote: Counting objects:  37% (10/27)        
remote: Counting objects:  40% (11/27)        
remote: Counting objects:  44% (12/27)        
remote: Counting objects:  48% (13/27)        
remote: Counting objects:  51% (14/27)        
remote: Counting objects:  55% (15/27)        
remote: Counting objects:  59% (16/27)        
remote: Counting objects:  62% (17/27)        
remote: Counting objects:  66% (18/27)        
remote: Counting objects:  70% (19/27)        
remote: Counting objects:  74% (20/27)        
remote: Counting objects:  77% (21/27)        
remote: Counting objects:  81% (22/27)        
remote: Counting objects:  85% (23/27)        
remote: Counting objects:  88% (24/27)        
remote: Counting objects:  92% (25/27)        
remote: Counting objects:  96% (26/27)        
remote: Counting objects: 100% (27/27)        
remote: Counting objects: 100% (27/27), done.        
remote: Compressing objects:  10% (1/10)        
remote: Compressing objects:  20% (2/10)        
remote: Compressing objects:  30% (3/10)        
remote: Compressing objects:  40% (4/10)        
remote: Compressing objects:  50% (5/10)        
remote: Compressing objects:  60% (6/10)        
remote: Compressing objects:  70% (7/10)        
remote: Compressing objects:  80% (8/10)        
remote: Compressing objects:  90% (9/10)        
remote: Compressing objects: 100% (10/10)        
remote: Compressing objects: 100% (10/10), done.        
remote: Total 33 (delta 17), reused 18 (delta 17), pack-reused 6        
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Note: switching to '31c90d5838e8d6e4c47d98500a34810ccb33a6d4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 31c90d5838 gh-111569: Implement Python critical section API (gh-111571)
Switched to and reset branch 'main'

configure: WARNING: using cross tools not prefixed with host triplet

../../Python/ceval_gil.c:429:1: warning: unused function 'current_thread_holds_gil' [-Wunused-function]
current_thread_holds_gil(struct _gil_runtime_state *gil, PyThreadState *tstate)
^
1 warning generated.
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:130:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:131:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:132:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:138:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) (htobe32((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:140:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:141:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:142:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/md5module.c:51:
In file included from ../../Modules/_hacl/Hacl_Hash_MD5.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:149:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) (htobe64((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
8 warnings generated.
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:130:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:131:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:132:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:138:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) (htobe32((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:140:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:141:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:142:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha1module.c:47:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA1.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:149:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) (htobe64((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
8 warnings generated.
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:130:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:131:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:132:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:138:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) (htobe32((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:140:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:141:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:142:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha3module.c:59:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA3.h:34:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:149:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) (htobe64((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
8 warnings generated.
../../Modules/expat/xmlparse.c:3116:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:3115:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:4059:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
../../Modules/expat/xmlparse.c:4058:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
../../Modules/expat/xmlparse.c:7703:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
          bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
          ^~~~~~~~~
3 warnings generated.
../../Modules/posixmodule.c:7596:13: warning: unused function 'warn_about_fork_with_threads' [-Wunused-function]
static void warn_about_fork_with_threads(const char* name) {
            ^
1 warning generated.
cat: pybuilddir.txt: No such file or directory
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:130:11: warning: 'htole32' macro redefined [-Wmacro-redefined]
#  define htole32(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:43:9: note: previous definition is here
#define htole32(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:131:11: warning: 'le32toh' macro redefined [-Wmacro-redefined]
#  define le32toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:44:9: note: previous definition is here
#define le32toh(x) (uint32_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:132:11: warning: 'htobe32' macro redefined [-Wmacro-redefined]
#  define htobe32(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:37:9: note: previous definition is here
#define htobe32(x) __bswap32(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:138:11: warning: 'be32toh' macro redefined [-Wmacro-redefined]
#  define be32toh(x) (htobe32((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:38:9: note: previous definition is here
#define be32toh(x) __bswap32(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:140:11: warning: 'htole64' macro redefined [-Wmacro-redefined]
#  define htole64(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:45:9: note: previous definition is here
#define htole64(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:141:11: warning: 'le64toh' macro redefined [-Wmacro-redefined]
#  define le64toh(x) (x)
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:46:9: note: previous definition is here
#define le64toh(x) (uint64_t)(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:142:11: warning: 'htobe64' macro redefined [-Wmacro-redefined]
#  define htobe64(x)                                                           \
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:39:9: note: previous definition is here
#define htobe64(x) __bswap64(x)
        ^
In file included from ../../Modules/sha2module.c:48:
In file included from ../../Modules/_hacl/Hacl_Hash_SHA2.h:35:
In file included from ../../Modules/_hacl/include/krml/types.h:12:
../../Modules/_hacl/include/krml/lowstar_endianness.h:149:11: warning: 'be64toh' macro redefined [-Wmacro-redefined]
#  define be64toh(x) (htobe64((x)))
          ^
/opt/wasi-sdk/bin/../share/wasi-sysroot/include/endian.h:40:9: note: previous definition is here
#define be64toh(x) __bswap64(x)
        ^
8 warnings generated.

Kill <WorkerThread #2 running test=test_capi pid=581307 time=25 min> process group
make: *** [Makefile:2041: buildbottest] Error 2

Cannot open file '/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.wasi/build/build/build_oot/host/test-results.xml' for upload

@brettcannon
Copy link
Member

Looks like this PR is causing the WASI buildbots to time out on the new test_critical_sections_threads test (WASI doesn't have thread support by default): https://buildbot.python.org/all/#/builders/1046/builds/3456/steps/11/logs/stdio .

@colesbury
Copy link
Contributor Author

Oops. I'll put up a PR to fix WASI tomorrow morning.

@colesbury colesbury deleted the critical_sections branch December 12, 2023 19:38
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Critical sections are helpers to replace the global interpreter lock
with finer grained locking.  They provide similar guarantees to the GIL
and avoid the deadlock risk that plain locking involves.  Critical
sections are implicitly ended whenever the GIL would be released.  They
are resumed when the GIL would be acquired.  Nested critical sections
behave as if the sections were interleaved.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Critical sections are helpers to replace the global interpreter lock
with finer grained locking.  They provide similar guarantees to the GIL
and avoid the deadlock risk that plain locking involves.  Critical
sections are implicitly ended whenever the GIL would be released.  They
are resumed when the GIL would be acquired.  Nested critical sections
behave as if the sections were interleaved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes topic-free-threading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants