Skip to content

arrow_stream + sslmode=require panics with PostgresPoolError(Error(None)) — works in arrow mode #909

Description

@ricardo-valero

What language are you using?

Python

What version are you using?

connectorx 0.4.4

What database are you using?

PostgreSQL (AWS RDS, sslmode=require)

What dataframe are you using?

Arrow / Arrow Streaming

Can you describe your bug?

return_type="arrow_stream" panics at connectorx/src/get_arrow.rs:318:22 (or :355 with protocol="cursor") during the initial Postgres connection setup when the URL has sslmode=require. The wrapped error is stripped to PostgresPoolError(Error(None)) because the streaming path uses .unwrap() where the bulk path (get_arrow) uses ?.

The exact same URL works in return_type="arrow".

What are the steps to reproduce the behavior?

import connectorx as cx

url = "postgresql://user:pass@host:5432/db?sslmode=require"

# Works
arrow = cx.read_sql(url, "SELECT 1", return_type="arrow")
print("arrow OK:", arrow.num_rows)

# Panics
reader = cx.read_sql(url, "SELECT 1", return_type="arrow_stream")
list(reader)

What is the error?

thread '<unnamed>' panicked at /Users/.../connectorx/src/get_arrow.rs:318:22:
called `Result::unwrap()` on an `Err` value: PostgresPoolError(Error(None))

(r2d2 runtime log surfaces the real cause:)
[r2d2] error communicating with the server: Connection reset by peer (os error 54)

Test matrix

No SSL sslmode=require
return_type="arrow"
return_type="arrow_stream" ✗ panic

Tried protocol={binary, cursor, simple}binary and cursor both panic identically at different line numbers (get_arrow.rs:318 and :355); simple is not implemented. Connection environment doesn't matter (reproducible with direct DSN and over an SSH tunnel).

Related

These all point at arrow_stream being a separately-implemented codepath with rougher edges than arrow. This issue adds SSL handshake to that list.

Suggested fix (visibility, at minimum)

Two .unwrap() calls in new_record_batch_iter should be ? (with #[throws(...)] on the function) to mirror get_arrow's error handling. That alone would surface the underlying r2d2 error instead of stripping it to Error(None). The root cause (why r2d2 connection setup fails under arrow_stream but not arrow with identical inputs) is a separate question worth tracing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions