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

pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: Ssl handshake failed: SSL_ERROR_SSL #117

Open
PetrSimik opened this issue Jan 23, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@PetrSimik
Copy link

PetrSimik commented Jan 23, 2025

Specifications

  • Client Version: influxdb3-python 0.10.0
  • InfluxDB Version: influxdb:20240819-1176644
  • Platform: MacOS Sequoia Version 15.2 (24C101)

Code sample to reproduce problem

from influxdb_client_3 import InfluxDBClient3

host = "influx.ntw.xxx.yyy"
database_name = "test/5m"
token = "my_api_key"
table = "test"

client = InfluxDBClient3(host=host,
database=database_name,
token=token,
verify_ssl=False,

                    )

result = client.query("SELECT * from test")

print(result)

Expected behavior

(.venv) petr@test:~/influx3-playground$ python influx3_read.py
pyarrow.Table
co: int64
hum: double
room: string
sensor: string
temp: double
time: timestamp[ns] not null

co: [[0,0,0,0,0,1,0,0,0,0,0],[0],[4]]
hum: [[35.9,36.2,36.1,36,36,36.5,35.9,35.9,36,36,35.9],[36],[36.9]]
room: [["Kitchen","Kitchen","Kitchen","Kitchen","Kitchen","Kitchen","Living Room","Living Room","Living Room","Living Room","Living Room"],["Living Room"],["garaga"]]
sensor: [[null,null,null,null,null,null,null,null,null,null,null],[null],["K001"]]
temp: [[21,23,22.7,22.4,22.5,22.8,21.1,21.4,21.8,22.2,22.2],[22.4],[72.2]]
time: [[2024-12-19 11:40:00.000000000,2024-12-19 12:40:00.000000000,2024-12-19 13:40:00.000000000,2024-12-19 14:40:00.000000000,2024-12-19 15:40:00.000000000,2024-12-19 16:40:00.000000000,2024-12-19 11:40:00.000000000,2024-12-19 12:40:00.000000000,2024-12-19 13:40:00.000000000,2024-12-19 14:40:00.000000000,2024-12-19 15:40:00.000000000],[2024-12-19 16:40:00.000000000],[2024-12-18 20:00:00.000000000]]

Actual behavior

E0123 06:31:31.376124000 8673821248 ssl_transport_security.cc:1501] Handshake failed with fatal error SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed.
Traceback (most recent call last):
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/influx3_read.py", line 17, in
result = client.query("SELECT * from test")
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/init.py", line 267, in query
return self._query_api.query(query=query, language=language, mode=mode, database=database, **kwargs)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 97, in query
raise e
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 81, in query
flight_reader = self._do_get(ticket, _options)
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 100, in _do_get
return self._flight_client.do_get(ticket, options)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "pyarrow/_flight.pyx", line 1633, in pyarrow._flight.FlightClient.do_get
File "pyarrow/_flight.pyx", line 68, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. gRPC client debug context: UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed {grpc_status:14, created_time:"2025-01-23T06:31:31.378154+01:00"}. Client context: IOError: Server never sent a data message. Detail: Internal

Additional info

So I tried ssl False, enforce context or all other options and still getting the err

`python
from influxdb_client_3 import InfluxDBClient3
import ssl

cert_path = "influx.ntw.xxx.yy.pem"
ssl_context = ssl.create_default_context(cafile=cert_path)

host = "influx.ntw..xxx.yy"
database_name = "test_petr/5m"
token = "token"
table = "test"

client = InfluxDBClient3(host=host,
database=database_name,
token=token,
# verify_ssl=False,
ssl_context=ssl_context
)

result = client.query("SELECT * from test")

print(result)
`

the same err:

E0123 11: 47:58.190666000 8673821248 ssl_transport_security.cc:1501] Handshake failed with fatal error SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. Traceback (most recent call last): File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/influx3_read.py", line 19, in <module> result = client.query("SELECT * from test") File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/__init__.py", line 267, in query return self._query_api.query(query=query, language=language, mode=mode, database=database, **kwargs) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 97, in query raise e File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 81, in query flight_reader = self._do_get(ticket, _options) File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 100, in _do_get return self._flight_client.do_get(ticket, options) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "pyarrow/_flight.pyx", line 1633, in pyarrow._flight.FlightClient.do_get File "pyarrow/_flight.pyx", line 68, in pyarrow._flight.check_flight_status pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. gRPC client debug context: UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed {grpc_status:14, created_time:"2025-01-23T11:47:58.191946+01:00"}. Client context: IOError: Server never sent a data message. Detail: Internal

checking ssl handshake works
`
import ssl
import socket

def evaluate_ssl_handshake(host, port=443):
try:
# Create a custom SSL context with your CA bundle
context = ssl.create_default_context(cafile="influx.ntw.xxx.yy.pem")

    # Set up the socket with an SSL context
    with socket.create_connection((host, port)) as sock:
        with context.wrap_socket(sock, server_hostname=host) as ssl_sock:
            # Print SSL/TLS certificate details
            cert = ssl_sock.getpeercert()
            print(f"SSL handshake to {host} successful!")
            print("Certificate details:")
            for key, value in cert.items():
                print(f"{key}: {value}")
            print(f"TLS version: {ssl_sock.version()}")
            print(f"Cipher suite: {ssl_sock.cipher()}")
except ssl.SSLError as e:
    print(f"SSL handshake failed: {e}")
except Exception as e:
    print(f"An error occurred: {e}")

Specify the host and port

host = "influx.ntw..xxx.yy"
evaluate_ssl_handshake(host)
`
this results
python stash/shake2.py
SSL handshake to influx.ntw.xxx.yy successful!

@PetrSimik PetrSimik added the bug Something isn't working label Jan 23, 2025
@bednar
Copy link
Member

bednar commented Jan 23, 2025

Hi @PetrSimik, it looks like there’s an issue with the detection of SSL communication on our side. Can you try adding https as a prefix to the host?

@PetrSimik
Copy link
Author

I tried https and the same result

@scaleoutsean
Copy link

I'm getting this as well and I'm not even trying to use HTTPS.

It'd be good to have an example on how to avoid HTTPS when connecting and use http://...:8181 to avoid overheads when evaluating or prototyping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants