Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error when establish the connection Redshift Serverless

未关闭
#249 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
databases

调研方向

首先,使用提供的 Python 代码片段复现连接,并检查 redshift_connector/core.py 中 Connection 初始化以及 trace 所示的 ssl_context.wrap_socket 调用附近的代码。将所报告的 Redshift Serverless 环境中的行为与文档记录的连接参数进行比较;完成的标准是确定一个可复现的驱动程序端原因,并验证连接能够成功建立。报告中没有指定 repository test。

由索引模型根据 Issue 内容生成。

描述

Driver version

2.1.5

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.80583

Client Operating System

Linux

Python version

3.12

Table schema

Not required

Problem description

  1. Expected behaviour: Established connection
  2. Actual behaviour: Failed to connect
  3. Error message/stack trace: redshift_connector.error.InterfaceError: ('communication error', SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)'))
  4. Any other details that can be helpful:

Python Driver trace logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/redshift_connector/core.py", line 671, in __init__
    self._usock = ssl_context.wrap_socket(self._usock)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/ssl.py", line 1042, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.12/ssl.py", line 1320, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/helper/redshift_helper.py", line 22, in create_connection
    _conn = rc.connect(
            ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redshift_connector/__init__.py", line 394, in connect
    return Connection(
           ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redshift_connector/core.py", line 698, in __init__
    raise InterfaceError("communication error", e)
redshift_connector.error.InterfaceError: ('communication error', SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/main.py", line 26, in <module>
    main()
  File "/app/main.py", line 18, in main
    ds.auto_create_views()
  File "/app/function/datashare.py", line 35, in auto_create_views
    self.rs_public2 = RedshiftHelper(
                      ^^^^^^^^^^^^^^^
  File "/app/helper/redshift_helper.py", line 18, in __init__
    self._conn = self.create_connection()
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/helper/redshift_helper.py", line 31, in create_connection
    raise Exception(str(e))
Exception: ('communication error', SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)'))

Reproduction code

code snippet

def create_connection(self):
    try:
        _conn = rc.connect(
            host=self._host,
            port=self._port,
            database=self._database,
            user=self._user,
            password=self._password,
        )
    except Exception as e:
        logger.error(f"failed connect to ({self._host}), {str(e)}")
        raise Exception(str(e))

    _conn.autocommit = True

    logger.info(f"redshift connection ({self._host}) established...")

    return _conn
主要语言
Python
星标
220
派生
88
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/amazon-redshift-python-driver 的其他 Issue

查看 aws/amazon-redshift-python-driver 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。