~/talk

Playing Minesweeper with Asyncpg

TalkinRussianat EkbPy 2023 · on Saturday, 2023-02-04· [python, databases]
links:none on file
slides:none on file

A Rambler&Co engineer describes a hard-to-reproduce memory-leak caused by asyncpg connections that became permanently stuck in the connection pool, leading to leaked shared-memory allocations in Postgres. The talk explains how they investigated the issue by attaching gdb to a live production Python process (with PYTHONOPTIMIZE), inspecting the Python garbage collector to find leaking objects, and ultimately fixed it by forcibly killing and recreating connections, while not finding the library root cause. It covers practical debugging techniques using gdb and Python’s gc module for asyncio/python/postgres/asyncpg users and ops who must debug running production services.

AI-written summary · about

  1. 0:00Introduction
  2. 0:26Memory leak problem
  3. 2:19Data server shared memory
  4. 3:42Memory leak symptoms
  5. 5:07Investigating issue
  6. 9:01Debugging challenges
  7. 12:55Debugging production
  8. 14:43GDB for Python
  9. 18:39Root cause found
  10. 21:30Process object analysis
  11. 22:35Object reference tracing
  12. 24:20Timeout errors cause
  13. 26:27Asyncpg connection pool
  14. 29:15Connection hang detection
  15. 31:03Python bug suspected
  16. 32:06Final solution
  17. 33:09Tool motivation
  18. 33:53Q&A
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.