Skip to content

Crash when modifying DLL function pointers conconcurrently #127946

Closed

Description

@ZeroIntensity

It seems that ctypes doesn't like having function pointers on a CDLL modified concurrently. Here's a reproducer (for Linux):

import ctypes
from threading import Thread

dll = ctypes.CDLL("libc.so.6")

def main():
    for _ in range(100):
        dll.puts.argtypes = ctypes.c_char_p,
        dll.puts.restype = ctypes.c_int

threads = [Thread(target=main) for _ in range(100)]
for thread in threads:
    thread.start()

Linked PRs

Activity

  1. changed the title [-]Crash when modifying DLL function pointers conconcurrently (report incoming)[/-] [+]Crash when modifying DLL function pointers conconcurrently[/+] on Dec 14, 2024
  2. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Dec 14, 2024
  3. ZeroIntensity commented on Dec 14, 2024

    @ZeroIntensity
    MemberAuthor

    PR ready, but waiting on #127950.

  4. added a commit that references this issue on Dec 20, 2024
  5. added a commit that references this issue on Dec 23, 2024
  6. added a commit that references this issue on Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions