aws / aws/amazon-redshift-python-driver
Error when establish the connection Redshift Serverless
- Ngôn ngữ chính
- Python
- Star
- 220
- Fork
- 86
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
## 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
```log
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
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
```python
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
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện kết nối với đoạn mã Python được cung cấp và kiểm tra redshift_connector/core.py xung quanh phần khởi tạo Connection và lời gọi ssl_context.wrap_socket được hiển thị trong trace. So sánh hành vi trong môi trường Redshift Serverless được báo cáo với các tham số kết nối đã được ghi lại; công việc được xem là hoàn tất khi xác định được nguyên nhân có thể tái hiện ở phía driver và xác minh rằng kết nối được thiết lập thành công. Báo cáo không nêu tên test nào của repository.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100