aws / aws/amazon-redshift-python-driver
Error when establish the connection Redshift Serverless
- Linguagem predominante
- Python
- Estrelas
- 220
- Forks
- 86
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
## 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
```
Guia de contribuição
Direção de pesquisa
Comece reproduzindo a conexão com o snippet Python fornecido e inspecione redshift_connector/core.py em torno da inicialização de Connection e da chamada a ssl_context.wrap_socket mostrada no trace. Compare o comportamento para o ambiente Redshift Serverless relatado com os parâmetros de conexão documentados; o trabalho estará concluído quando uma causa reproduzível no lado do driver for identificada e for verificado que a conexão é estabelecida com sucesso. Nenhum teste do repositório é mencionado no relatório.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- databases
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100