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

Starting a transaction can sometimes fail #5

Open
jjatria opened this issue Oct 28, 2021 · 0 comments
Open

Starting a transaction can sometimes fail #5

jjatria opened this issue Oct 28, 2021 · 0 comments

Comments

@jjatria
Copy link
Contributor

jjatria commented Oct 28, 2021

The code in Plack::Middleware::NewFangle assumes that start_web_transaction always returns a valid transaction. This is partially the case: it will always return an object you can call methods on, and the methods will only do useful things when the transaction is valid.

However, starting a transaction can sometimes fail. In those cases, you get a null transaction, and since the code does not check whether the transaction is valid or not, you end up with a lot of noise in the logs:

2021-10-28 14:53:11.882 +0100 (11 11) error: unable to start transaction
2021-10-28 14:53:11.882 +0100 (11 11) error: unable to add attribute for a NULL transaction
2021-10-28 14:53:11.882 +0100 (11 11) error: unable to add attribute for a NULL transaction
2021-10-28 14:53:11.882 +0100 (11 11) error: unable to add attribute for a NULL transaction
2021-10-28 14:53:11.882 +0100 (11 11) error: unable to start segment with NULL transaction

However, it does not seem like there is an easy way to check whether the transaction is valid or not: there is no method to check it in NewFangle, and the documentation for start_web_transaction does not actually mention the possibility of it retuning an invalid transaction:

Given an application pointer and transaction name, this function begins timing a new transaction. It returns a valid pointer to an active New Relic transaction, newrelic_txn_t. The return value of this function may be used as an input parameter to functions that modify an active transaction.

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

1 participant