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

nrpgx5 transaction issue during segment close #976

Open
akushsky opened this issue Oct 20, 2024 · 1 comment
Open

nrpgx5 transaction issue during segment close #976

akushsky opened this issue Oct 20, 2024 · 1 comment
Labels

Comments

@akushsky
Copy link

I'm trying to switch legacy nrpgx-based project to nrpgx5.
I have a lot of requests (all my SELECT ones) that are not wrapped to transactions.
Previously it was working perfectly, but now it occurs an error log on each segment close.
It doesn't affect real NewRelic data, I could see all graphs etc., but it's flooding to my log output.

What I'm doing wrong? It's a must to wrap each request (even if it's a SELECT) to transaction?

Unable to end datastore segment - product: Postgres collection: table_name operation: select reason: transaction has already ended [init]

newrelic.(*DatastoreSegment).End (segments.go:206) github.com/newrelic/go-agent/v3/newrelic
nrpgx5.(*Tracer).TraceQueryEnd (nrpgx5.go:170) github.com/newrelic/go-agent/v3/integrations/nrpgx5
pgx.(*baseRows).Close (rows.go:188) github.com/jackc/pgx/v5
stdlib.(*Rows).Close (sql.go:693) github.com/jackc/pgx/v5/stdlib
sql.(*Rows).close.func1 (sql.go:3450) database/sql
sql.withLock (sql.go:3566) database/sql
sql.(*Rows).close (sql.go:3449) database/sql
sql.(*Rows).Close (sql.go:3433) database/sql
........
runtime.main (proc.go:272) runtime
runtime.goexit (asm_arm64.s:1223) runtime
 - Async Stack Trace
<autogenerated>:2

@akushsky akushsky added the bug label Oct 20, 2024
@mirackara
Copy link
Contributor

Hi @akushsky,

Transactions have to be open to close out datastore segments properly

txn := app.StartTransaction("postgresQuery")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants