Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when establish the connection Redshift Serverless #249

Open
amzar96 opened this issue Dec 31, 2024 · 0 comments
Open

Error when establish the connection Redshift Serverless #249

amzar96 opened this issue Dec 31, 2024 · 0 comments

Comments

@amzar96
Copy link

amzar96 commented Dec 31, 2024

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
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

No branches or pull requests

1 participant