SIGSEGV in libmsodbcsql during process teardown (iconv_close) on macOS arm64 with concurrent encrypted connections
Los mantenedores suelen responder en 2 días
@bewithgaurav ya está trabajando en esto.
Desde el 20/7/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
On macOS arm64, the process crashes with SIGSEGV during interpreter/process teardown (exit() → __cxa_finalize_ranges), inside the driver's static destructor calling iconv_close. The crash surfaces at shutdown when multiple worker threads have been using encrypted connections (Encrypt=yes) concurrently. The process terminates with exit code 139 and no Python traceback.
This appears related to, but distinct from, #668 (TLS stream corruption on concurrent encrypted reads — data corruption, no crash) and #679 (SIGSEGV in SQLFetchScroll during concurrent fetchmany). Here the faulting frame is not SQLFetchScroll but the driver's teardown path via libiconv.
Environment
- macOS 26.5.2 (build 25F84), Apple Silicon (arm64)
- Python 3.12.11
- mssql-python 1.11.0 (bundled
libmsodbcsql.18.dylib,mssql_python/libs/macos/arm64) - SQLAlchemy 2.1.0b3
- Connection options:
Encrypt=yes,TrustServerCertificate=yes,SNAPSHOTisolation - Concurrency: multiple worker threads. mssql-python's native connection pooling is enabled (
enable_pooling=True), which uses a process-global pooling manager, so encrypted connections are pooled and reused across the process rather than being one-per-thread.
Crash
Signal: SIGSEGV / EXC_BAD_ACCESS (KERN_INVALID_ADDRESS), subtype "possible pointer authentication failure" at a wild address.
Faulting thread (from the macOS .ips crash report):
libiconv.2.dylib _citrus_iconv_close
libiconv.2.dylib __bsd_iconv_close
libmsodbcsql.18.dylib <driver frame>
libsystem_c.dylib __cxa_finalize_ranges
libsystem_c.dylib exit
libdyld.dylib dyld4::LibSystemHelpers::exit(int) const
dyld dyld4::LibSystemHelpersWrapper::exit(int) const
dyld start
So the crash happens while the process is exiting: exit() runs C++ static destructors (__cxa_finalize_ranges), one of which belongs to libmsodbcsql.18.dylib and calls iconv_close on what looks like an already-freed or corrupted iconv handle, producing a pointer-authentication failure.
Scenario
- Several worker threads read from different tables concurrently under
SNAPSHOTisolation over pooled encrypted connections (Encrypt=yes). - The application begins shutting down (an unrelated application-level error triggers a fail-fast
exit()) while those threads/connections are still being torn down. - During
exit(), the driver's static-destructor cleanup segfaults iniconv_close.
The iconv involvement is notable: iconv is the character-encoding conversion layer, and #668 reports TLS/stream corruption specifically under concurrent encrypted reads on arm64. A corrupted iconv handle that only faults at driver finalization is consistent with encoding/stream state being left in a bad state under that same concurrency.
Relation to existing issues
- #668 — TLS stream corruption on concurrent encrypted reads (arm64): data corruption / protocol errors, no hard crash.
- #679 — SIGSEGV in
SQLFetchScrollduring concurrentfetchmany(arm64).
This report is a third manifestation on the same platform and connection profile (macOS arm64, Encrypt=yes, concurrent threaded reads), but the crash occurs at process teardown via libiconv, not during an active fetch. Filing separately so the teardown/iconv stack is tracked; it may share the root cause reported in #668.
Notes
- No Python-level exception is raised for the crash itself; only the exit code (139) and the macOS crash report indicate it.
- Lenguaje dominante
- Python
- Estrellas
- 478
- Forks
- 62
- Merge medio
- 3 d 19 min
- PR fusionados (30 d)
- 28
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/mssql-python
-
area: bulk-copy triage needed
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
microsoft/mssql-python#843 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
triage needed
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/mssql-python#846 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
macOS: encrypted connections fail after Homebrew moved the `openssl` alias to `openssl@4`Posiblemente ocupada @bewithgaurav la tomó hace 15 días. Abiertoarea: packaging-platform bug triage needed
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
microsoft/mssql-python#826 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Announcement: mssql-python is coming to Django through mssql-django 2.0Quizá libre de nuevo @bewithgaurav la tomó hace 41 días y no hay ningún pull request abierto. Abiertoannouncement
microsoft/mssql-python#748 · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Connection pool can briefly exceed max_size when pooling is disabled under loadPosiblemente ocupada @bewithgaurav la tomó hace 24 días. Abiertoarea: connectivity-auth bug triage done under development
Dificultad 4/5 3-5 días Aptitud para principiantes 62/100
microsoft/mssql-python#746 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/mssql-python
Issues similares
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
WingedGuardian/GENesis-AGI#3375 ·
Los mantenedores suelen responder en 1 día
-
curriculum documentation quality
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
githubnext/gh-aw-workshop#4601 ·
Los mantenedores suelen responder en 1 día
-
approved Good First Issue scope: docs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
hiero-ledger/hiero-sdk-python#2730 · 3 comentarios ·
Los mantenedores suelen responder en 1 día