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

[Bug]: postgresql pgbouncer prepared statement , encode plan #1509

Closed
2 tasks done
todeb opened this issue Jan 12, 2024 · 3 comments
Closed
2 tasks done

[Bug]: postgresql pgbouncer prepared statement , encode plan #1509

todeb opened this issue Jan 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@todeb
Copy link

todeb commented Jan 12, 2024

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration issue.
  • This issue is not already reported on Github (I've searched it).

Bug description

running sftpgo with postgresql and pgbouncer:

When sftpgo is killed, prepared statement seems not be cleaned and error is triggered:

SFTPGO_DATA_PROVIDER__CONNECTION_STRING="postgresql://sftpgo:sftpgo@mydbserver/sftpgo?sslmode=require"

{"level":"error","time":"2024-01-12T16:03:32.162","sender":"service","message":"error initializing data provider: ERROR: prepared statement \"stmtcache_1\" already exists (SQLSTATE 42P05)"}

when changing to:

SFTPGO_DATA_PROVIDER__CONNECTION_STRING="postgresql://sftpgo:sftpgo@mydbserver/sftpgo?sslmode=require&default_query_exec_mode=simple_protocol"

{"level":"error","time":"2024-01-12T16:01:17.447","sender":"service","message":"error initializing data provider: unable to encode 1 into text format for unknown type (OID 0): cannot find encode plan"}

Steps to reproduce

  1. setup posthres with pgboucer
  2. setup sftpgo to use pgbouncer
  3. kill sftpgo

Expected behavior

should work with pgbouncer by default or by setting some parameters in connection string

SFTPGo version

drakkan/sftpgo:v2.5.6-alpine

Data provider

name=sftpgo ; driver=postgresql

Installation method

Community Docker image

Configuration

config

Relevant log output

No response

What are you using SFTPGo for?

Medium business

Additional info

No response

@todeb todeb added the bug Something isn't working label Jan 12, 2024
@drakkan
Copy link
Owner

drakkan commented Jan 28, 2024

This is probably a problem in the pgx library. Please write and share a standalone reproducer using pgx in database/sql mode and confirm that it works instead. Thank you

@todeb
Copy link
Author

todeb commented Jan 29, 2024

I used hashicorp vault with pgx with simple protocol and was ok. Which pgx version should I try? Any specific recommendation what reproducer should contain? Or should I just connect, do some insert and select?

@drakkan
Copy link
Owner

drakkan commented May 15, 2024

see this discussion for some more details.

Simple protocol is not supported in SFTPGo. Please test the other query exec modes and re-open if they don't work (I haven't done any tests myself).

I'd like to see a benchmark to understand the performance differences with and without pgbouncer in a real-world use case. Thank you

@drakkan drakkan closed this as completed May 15, 2024
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

2 participants