asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

Segmentation fault on 0.31.0 when inside a Temporal activity

Open idevelop opened this issue 3 weeks ago • 4 comments

I'm not sure if the root cause is with asyncpg or with temporal but this code works fine on 0.30.0, and crashes on 0.31.0 in await asyncpg.connect. Python 3.12.9.

#!/usr/bin/env python
import asyncio
import threading
from datetime import datetime, timedelta

import asyncpg
from temporalio import activity, workflow
from temporalio.client import Client
from temporalio.worker import Worker

TASK_QUEUE = "asyncpg-temporal-test"


async def db_call(label: str) -> None:
    """Connect to Postgres and close."""
    loop = asyncio.get_running_loop()
    print(f"[{label}] thread={threading.get_ident()} loop_id={id(loop)} {loop!r}")

    conn = await asyncpg.connect(
        host="localhost",
        port=5432,
        database="database",
        user="andrei",
    )

    print(f"[{label}] connected to Postgres")

    await conn.close()


@activity.defn
async def db_activity() -> None:
    return await db_call("activity")


@workflow.defn
class TestWorkflow:
    @workflow.run
    async def run(self) -> None:
        print("[workflow] starting db_activity")
        return await workflow.execute_activity(
            db_activity,
            start_to_close_timeout=timedelta(seconds=30),
            task_queue=TASK_QUEUE,
        )


async def main() -> None:
    # 1) Baseline: asyncpg on a fresh loop, no Temporal
    print("=== 1) Direct asyncpg on fresh loop (no Temporal) ===")
    await db_call("direct")

    # 2) Bring up Temporal client + worker and run a workflow that calls db_activity
    print("\n=== 2) Temporal worker + workflow calling async activity ===")
    client = await Client.connect("localhost:7233")
    worker = Worker(
        client,
        task_queue=TASK_QUEUE,
        workflows=[TestWorkflow],
        activities=[db_activity],
    )

    async with worker:
        # This executes TestWorkflow.run, which in turn executes db_activity
        result = await client.execute_workflow(
            TestWorkflow.run,
            id=datetime.now().isoformat(),
            task_queue=TASK_QUEUE,
        )
        print(f"[main] workflow result: {result}")


if __name__ == "__main__":
    asyncio.run(main())

Repro steps:

  1. Start a temporal server: temporal server start-dev
  2. In a separate terminal, run the code above:
% python test_asyncpg.py               

=== 1) Direct asyncpg on fresh loop (no Temporal) ===
[direct] thread=8654430720 loop_id=4353195520 <_UnixSelectorEventLoop running=True closed=False debug=False>
[direct] connected to Postgres

=== 2) Temporal worker + workflow calling async activity ===
[workflow] starting db_activity
[activity] thread=8654430720 loop_id=4353195520 <_UnixSelectorEventLoop running=True closed=False debug=False>
zsh: segmentation fault  python test_asyncpg.py

idevelop avatar Dec 02 '25 17:12 idevelop

@elprans this may be of interest, I notice you made many of the heavy changes in this version

idevelop avatar Dec 02 '25 17:12 idevelop

@idevelop any chance for a traceback or coredump?

elprans avatar Dec 03 '25 00:12 elprans

Process 55553 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100c8e23c protocol.cpython-312-darwin.so`__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__ + 428
protocol.cpython-312-darwin.so`__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__:
->  0x100c8e23c <+428>: ldr    w8, [x25]
    0x100c8e240 <+432>: adds   w8, w8, #0x1
    0x100c8e244 <+436>: b.hs   0x100c8e24c    ; <+444>
    0x100c8e248 <+440>: str    w8, [x25]
Target 0: (python) stopped.
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000100c8e23c protocol.cpython-312-darwin.so`__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__ + 428
    frame #1: 0x000000010167dfe0 libpython3.12.dylib`type_call + 148
    frame #2: 0x0000000101469710 libpython3.12.dylib`_PyEval_EvalFrameDefault + 164272
    frame #3: 0x00000001014fdc60 libpython3.12.dylib`gen_send_ex2 + 188
    frame #4: 0x0000000101d42344 libpython3.12.dylib`task_step_impl + 444
    frame #5: 0x0000000101d42110 libpython3.12.dylib`task_step + 60
    frame #6: 0x0000000101d43420 libpython3.12.dylib`task_wakeup + 236
    frame #7: 0x0000000101590420 libpython3.12.dylib`cfunction_vectorcall_O.llvm.17996990451748395886 + 108
    frame #8: 0x0000000101d2d838 libpython3.12.dylib`_PyObject_VectorcallTstate + 68
    frame #9: 0x0000000101d2d718 libpython3.12.dylib`context_run + 156
    frame #10: 0x00000001016767d4 libpython3.12.dylib`cfunction_vectorcall_FASTCALL_KEYWORDS.llvm.17996990451748395886 + 92
    frame #11: 0x000000010146d0e4 libpython3.12.dylib`_PyEval_EvalFrameDefault + 179076
    frame #12: 0x000000010150f908 libpython3.12.dylib`PyEval_EvalCode + 220
    frame #13: 0x000000010150f75c libpython3.12.dylib`run_mod.llvm.12194046240795210664 + 284
    frame #14: 0x000000010158a5fc libpython3.12.dylib`pyrun_file + 156
    frame #15: 0x0000000101589d3c libpython3.12.dylib`_PyRun_SimpleFileObject + 268
    frame #16: 0x00000001015811e4 libpython3.12.dylib`_PyRun_AnyFileObject + 80
    frame #17: 0x00000001015805a0 libpython3.12.dylib`pymain_run_file_obj + 164
    frame #18: 0x000000010157fc00 libpython3.12.dylib`pymain_run_file + 72
    frame #19: 0x000000010157de04 libpython3.12.dylib`Py_RunMain + 1120
    frame #20: 0x000000010157d808 libpython3.12.dylib`pymain_main + 456
    frame #21: 0x000000010157d634 libpython3.12.dylib`Py_BytesMain + 36
    frame #22: 0x000000018ec4ab98 dyld`start + 6076
  thread #2
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x00000001014edb80 libpython3.12.dylib`PyThread_acquire_lock_timed + 368
    frame #3: 0x0000000101d6d394 libpython3.12.dylib`_queue_SimpleQueue_get_impl + 232
    frame #4: 0x0000000101d6d0f8 libpython3.12.dylib`_queue_SimpleQueue_get + 220
    frame #5: 0x00000001016633f0 libpython3.12.dylib`method_vectorcall_FASTCALL_KEYWORDS_METHOD.llvm.10305734732062514342 + 132
    frame #6: 0x00000001014693a8 libpython3.12.dylib`_PyEval_EvalFrameDefault + 163400
    frame #7: 0x000000010165ee6c libpython3.12.dylib`method_vectorcall.llvm.15681140478531841773 + 356
    frame #8: 0x00000001015c4f80 libpython3.12.dylib`thread_run + 120
    frame #9: 0x0000000101d3c3c4 libpython3.12.dylib`pythread_wrapper.llvm.2170858709195324550 + 48
    frame #10: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #3, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #4, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #5, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #6, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #7, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #8, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #9, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efafd04 libsystem_kernel.dylib`kevent + 8
    frame #1: 0x000000010ae76374 temporal_sdk_bridge.abi3.so`tokio::runtime::io::driver::Driver::turn::h055176fc47a22c9f + 468
    frame #2: 0x000000010ae76d40 temporal_sdk_bridge.abi3.so`tokio::runtime::time::Driver::park_internal::h8cf680c0138b6343 + 808
    frame #3: 0x000000010ae6d5a0 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 216
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #10, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #11, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #12, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #13, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #14, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #15, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #16, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a48d8 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 524
    frame #3: 0x000000010ae6d668 temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout::h1ab35f8bfc4fead1 + 416
    frame #4: 0x000000010ae5d428 temporal_sdk_bridge.abi3.so`tokio::runtime::task::raw::poll::hfbd9212df7e5636a + 4384
    frame #5: 0x000000010ae67694 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 400
    frame #6: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #7: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #8: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #17, name = 'tokio-runtime-worker'
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x000000010a0a4928 temporal_sdk_bridge.abi3.so`parking_lot::condvar::Condvar::wait_until_internal::h99bf3f90cfdb0bca + 604
    frame #3: 0x000000010ae67730 temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::h88aab4b4786d19bd + 556
    frame #4: 0x000000010ae68664 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h905d31393ce10a5f + 380
    frame #5: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #6: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #18, name = 'workflow-processing'
    frame #0: 0x000000018efafd04 libsystem_kernel.dylib`kevent + 8
    frame #1: 0x000000010ae76374 temporal_sdk_bridge.abi3.so`tokio::runtime::io::driver::Driver::turn::h055176fc47a22c9f + 468
    frame #2: 0x000000010ae76d40 temporal_sdk_bridge.abi3.so`tokio::runtime::time::Driver::park_internal::h8cf680c0138b6343 + 808
    frame #3: 0x000000010ae71c1c temporal_sdk_bridge.abi3.so`tokio::runtime::scheduler::current_thread::Context::park::h0a954e21e92549a9 + 488
    frame #4: 0x000000010abf890c temporal_sdk_bridge.abi3.so`std::sys::backtrace::__rust_begin_short_backtrace::hcd1872a5a23ecfbc + 5168
    frame #5: 0x000000010ac000b0 temporal_sdk_bridge.abi3.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h8097310623a58636 + 500
    frame #6: 0x000000010a2a15e8 temporal_sdk_bridge.abi3.so`std::sys::pal::unix::thread::Thread::new::thread_start::h87df50f049a92661 + 60
    frame #7: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
  thread #19
    frame #0: 0x000000018efad3cc libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x000000018efec09c libsystem_pthread.dylib`_pthread_cond_wait + 984
    frame #2: 0x00000001014edb80 libpython3.12.dylib`PyThread_acquire_lock_timed + 368
    frame #3: 0x0000000101d6d394 libpython3.12.dylib`_queue_SimpleQueue_get_impl + 232
    frame #4: 0x0000000101d6d0f8 libpython3.12.dylib`_queue_SimpleQueue_get + 220
    frame #5: 0x00000001016633f0 libpython3.12.dylib`method_vectorcall_FASTCALL_KEYWORDS_METHOD.llvm.10305734732062514342 + 132
    frame #6: 0x00000001014693a8 libpython3.12.dylib`_PyEval_EvalFrameDefault + 163400
    frame #7: 0x000000010165ee6c libpython3.12.dylib`method_vectorcall.llvm.15681140478531841773 + 356
    frame #8: 0x00000001015c4f80 libpython3.12.dylib`thread_run + 120
    frame #9: 0x0000000101d3c3c4 libpython3.12.dylib`pythread_wrapper.llvm.2170858709195324550 + 48
    frame #10: 0x000000018efebbc8 libsystem_pthread.dylib`_pthread_start + 136
(lldb) 
python │ EXC_BAD_ACCESS (code=1, address=0x0)                                                                                                                                                                        

idevelop avatar Dec 03 '25 17:12 idevelop

Fatal Python error: Segmentation fault

Thread 0x00000001733e7000 (most recent call first):
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/concurrent/futures/thread.py", line 90 in _worker
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1012 in run
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1075 in _bootstrap_inner
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1032 in _bootstrap

Thread 0x000000017031b000 (most recent call first):
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/concurrent/futures/thread.py", line 90 in _worker
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1012 in run
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1075 in _bootstrap_inner
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/threading.py", line 1032 in _bootstrap

Current thread 0x00000001fcf7e200 (most recent call first):
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connect_utils.py", line 1078 in <lambda>
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connect_utils.py", line 994 in _create_ssl_connection
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connect_utils.py", line 1099 in __connect_addr
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connect_utils.py", line 1054 in _connect_addr
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connect_utils.py", line 1218 in _connect
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/asyncpg/connection.py", line 2443 in connect
  File "/Users/andrei/test_asyncpg.py", line 23 in db_call
  File "/Users/andrei/test_asyncpg.py", line 55 in db_activity
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/temporalio/worker/_activity.py", line 805 in execute_activity
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/temporalio/worker/_activity.py", line 610 in _execute_activity
  File "/Users/andrei/.virtualenvs/lib/python3.12/site-packages/temporalio/worker/_activity.py", line 297 in _handle_start_activity_task
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/events.py", line 88 in _run
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 1999 in _run_once
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 645 in run_forever
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 678 in run_until_complete
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 118 in run
  File "/Users/andrei/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 195 in run
  File "/Users/andrei/test_asyncpg.py", line 102 in <module>

Extension modules: asyncpg.pgproto.pgproto, asyncpg.protocol.record, asyncpg.protocol.protocol, hiredis.hiredis, bson._cbson, pymongo._cmessage, _cffi_backend, zstandard.backend_c, simplejson._speedups, charset_normalizer.md, tornado.speedups, google._upb._message, grpc._cython.cygrpc (total: 13)
zsh: segmentation fault  PYTHONFAULTHANDLER=1 python test_asyncpg.py

idevelop avatar Dec 03 '25 17:12 idevelop