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

PgBouncer special settings? #1385

Closed
MrBadge opened this issue Sep 17, 2019 · 4 comments
Closed

PgBouncer special settings? #1385

MrBadge opened this issue Sep 17, 2019 · 4 comments

Comments

@MrBadge
Copy link

MrBadge commented Sep 17, 2019

When connecting to the DB through the PgBouncer the following errors approximately every 30 seconds are received:

pg: 2019/09/17 20:52:10 listener.go:126: pg: discarding bad listener connection: pg: readSimpleQuery: unexpected message 'A'

Seems it should be notificationResponseMsg, but the error comes from the readSimpleQuery method.

PG connection options:

opts := &pg.Options{
		User:        conf.User,
		Password:    conf.Pass,
		Database:    conf.DB,
		Addr:        fmt.Sprintf("%s:%s", conf.Host, conf.Port),
		PoolSize:    10,
		PoolTimeout: time.Second * 30,
	}

Do I have to use MaxConnAge or some other options to avoid this?

@MrBadge
Copy link
Author

MrBadge commented Sep 17, 2019

Found that PG listeners are incompatible with the Transaction pooling method of PgBouncer (https://pgbouncer.github.io/features.html)

@MrBadge MrBadge closed this as completed Sep 17, 2019
@kidoman
Copy link

kidoman commented Dec 12, 2022

So what pooling method did you end up using? I need to use pgbouncer with go-pg so trying to make sure I am prepared.

@MrBadge
Copy link
Author

MrBadge commented Dec 12, 2022

@kidoman session pooling was the only option, because of the listen\notify support

@kidoman
Copy link

kidoman commented Dec 12, 2022

@MrBadge thanks for the reply. Does session pooling help with too many idle conenctions being held by individual containers with go-pg? I will do my own research of course, but thought you might already have encountered this issue.

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

2 participants