snowflakedb / snowflake-connector-python

Snowflake Connector for Python
https://pypi.python.org/pypi/snowflake-connector-python/
Apache License 2.0
601 stars 473 forks source link

SNOW-1632317: connector does not retry in certain cases where connector receives None response from the server #2030

Open sfc-gh-aling opened 3 months ago

sfc-gh-aling commented 3 months ago

Python version

any

Operating system and processor architecture

any

Installed packages

snowflake-connector-python

What did you do?

server sometimes send back http response with None, leading to the connector raises UnknownError, this could happen at any http requests

What did you expect to see?

retry upon None without any side effect

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)

more context

in the PR SNOW-1562604: enhance error handling when polling query result by sfc-gh-aling · Pull Request #2027 · snowflakedb/snowflake-connector-python we enhanced retry on handling 499 error (client receiving None response) when polling long running query result.

there are more get/post requests in the connector which need similar enhancement, but they also need more tests.

sfc-gh-dszmolka commented 3 months ago

(looks to be an internal tracking issue)