Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix ARM64 segfault on connect failure with libpq 506#33

Merged
jarrenL merged 1 commit into
huaweicloud-samples:masterfrom
Dark-Athena:fix-issue-30-arm64-segfault
Jun 25, 2026
Merged

Fix ARM64 segfault on connect failure with libpq 506#33
jarrenL merged 1 commit into
huaweicloud-samples:masterfrom
Dark-Athena:fix-issue-30-arm64-segfault

Conversation

@Dark-Athena

@Dark-Athena Dark-Athena commented Apr 29, 2026

Copy link
Copy Markdown

Summary

  • avoid broad failed-PGconn attribute introspection in finish_pgconn()
  • build a safe failed-connection snapshot from explicit fields
  • sanitize _connect() failure branches to pass conninfo-derived diagnostics
  • add a regression test ensuring finish_pgconn() doesn't read arbitrary PGconn attributes
  • document the fix in release notes

Validation

  • reproduced on ARM64 remote env:
    • libpq 505.2: expected connection error (no crash)
    • libpq 506.0: segfault before patch, normal OperationalError after patch
  • checked failed-connection diagnostics still expose pgconn.db and sane status values

Closes #30

@Dark-Athena Dark-Athena force-pushed the fix-issue-30-arm64-segfault branch from 97b72ee to 94043f7 Compare April 29, 2026 09:54
@Dark-Athena Dark-Athena force-pushed the fix-issue-30-arm64-segfault branch from 94043f7 to 46c4360 Compare April 29, 2026 10:07
@jarrenL jarrenL merged commit 9481e98 into huaweicloud-samples:master Jun 25, 2026
jarrenL added a commit to jarrenL/gaussdb-python that referenced this pull request Jun 25, 2026
新增 gaussdb_sqlalchemy 方言包:
- base.py: GaussDBDialect, A/B/M 兼容模式自动检测和适配
  - M 模式: AUTO_INCREMENT, TIMESTAMP(6), CONCAT(), 反引号, LAST_INSERT_ID
  - A/B 模式: SERIAL, ||, 双引号, RETURNING
- alembic.py: Alembic 集成, M 兼容 MODIFY COLUMN 语法
- 连接串: gaussdb://user:pass@host:port/db?sslmode=disable

Python 3.7+ 兼容:
- _oids.py: 加 from __future__ import annotations
- _tz.py: zoneinfo 兼容 backports.zoneinfo (3.7/3.8)
- pyproject.toml: requires-python >= 3.7, 加 3.7/3.8 classifiers
- pyproject.toml: typing-extensions 版本限制 + backports.zoneinfo 依赖

PR huaweicloud-samples#33 coredump 修复已在 master 中(上一个 commit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARM64环境下,使用gaussdb 506.0SPC0100版本的libpq,在连接失败的时候python进程会coredump

2 participants