GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlite3 converter lookup can crash during concurrent registry updates in free-threaded builds · Issue #155781 · python/cpython Closed Labels extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtopic-sqlite3type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump DescriptionBug reportBug description:In retval = PyDict_GetItemWithError(state->converters, upcase_key); return retval;
In a free-threaded build, another thread can replace or remove the converter after the dictionary lookup has completed but before The converter registry can be modified either through: sqlite3.register_converter(name, replacement) or directly through the public A possible sequence is:
A stress test on a free-threaded debug build of CPython main reproduces an interpreter crash. The adapter registry already uses A proposed fix is to make Reproducerimport sqlite3 import threading NAME = "CONVERTER_RACE" NCOLUMNS = 64 NITER = 3000 QUERY = "select " + ", ".join( f"'value' as 'c{i} [{NAME}]'" for i in range(NCOLUMNS) ) class Converter: __slots__ = ("value",) def __init__(self, value): self.value = value def __call__(self, value): return self.value def reader(): con = sqlite3.connect( ":memory:", detect_types=sqlite3.PARSE_COLNAMES, ) try: for _ in range(NITER): con.execute(QUERY).fetchone() finally: con.close() def mutator(): for i in range(NITER * NCOLUMNS): sqlite3.register_converter(NAME, Converter(i)) if i % 3 == 0: sqlite3.converters.pop(NAME, None) threads = [ *[threading.Thread(target=reader) for _ in range(8)], *[threading.Thread(target=mutator) for _ in range(2)], ] for thread in threads: thread.start() for thread in threads: thread.join() CPython versions tested on:CPython main branch Operating systems tested on:macOS Linked PRsActivity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtopic-sqlite3type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |