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

(Memory Leak) Strange behavior in MetricNameService.RenameTransaction #337

Closed
tiagodaraujo opened this issue Oct 30, 2020 · 7 comments · Fixed by #338
Closed

(Memory Leak) Strange behavior in MetricNameService.RenameTransaction #337

tiagodaraujo opened this issue Oct 30, 2020 · 7 comments · Fixed by #338
Assignees
Labels
bug Something isn't working

Comments

@tiagodaraujo
Copy link

tiagodaraujo commented Oct 30, 2020

During a memory leak analysis, I found a list of transactions stored on the MetricNameService. The list stored in the _transactionNames instance field, increases progressively, even using the SetTransactionName for grouping or IgnoreTransaction API call.

Description
MetricNameService stores a list of unique transactions in the instance field _transactionNames, here.
The method IsMetricNameAllowed stored the transaction but never use the list and return always true.
It seems a strange behavior because the IsMetricNameAllowed result is used in the method RenameTransaction.
Why do you need an if in your code, if the operation is always true? here.

Expected Behavior
I expect for a web request that I call your API methods, NewRelic.SetTransactionName or NewRelic.IgnoreTransaction, the MetricNameService doesn't store the transaction. e.g.

WebRequest: /product/product-seo-description-123.aspx
Call API: NewRelic.SetTransactionName(null, "Product-Detail-Page")
Records:
WebTransaction/ASP/product/product-seo-description-123.aspx
WebTransaction/MVC/Product/Index/{id}
WebTransaction/Custom/Product-Detail-Page
I expect:
WebTransaction/Custom/Product-Detail-Page

WebRequest: /static/image.png
Call API: NewRelic.IgnoreTransaction()
Records:
WebTransaction/ASP/static/image.png
I expect:
No transaction records.

Note: In the NewRelic dashboard, Transactions view, all seems right and shows the expected results. Ignored transactions are not showed and custom transactions are shown as expected.

Troubleshooting or NR Diag results
I don't have a log to be shared here, but I already shared other information internally with the NewRelic support team member.

Steps to Reproduce
Just do some traffic and you can see the duplicated transaction names on the MetricServiceName. I extracted a memory dump to have access to the object stored.

Your Environment
I using the NewRelic agent 8.34 version in a ASP.NET Core application hosted by a Windows Server with IIS.

Additional context
snippet API calls: https://gist.github.com/tiagodaraujo/c3d9ac425019b26b29c66e7f01015470

@tiagodaraujo tiagodaraujo added the bug Something isn't working label Oct 30, 2020
@tiagodaraujo tiagodaraujo changed the title (Memory Leak) Strange behavior with metrics rename on MetricNameService (Memory Leak) Strange behavior in MetricNameService.RenameTransaction Oct 30, 2020
@nr-ahemsath
Copy link
Member

@tiagodaraujo: Thank you for bringing this to our attention. You are correct, based on an initial reading, this logic does not make much sense. At the very least, the name of the IsTransactionNameAllowed method is misleading given the current actual behavior of the method. I'll be looking into this today.

@nr-ahemsath
Copy link
Member

@tiagodaraujo See the linked pull request. Again, thanks for bringing this issue to our attention. This turns out to be obsolete code that should have been removed when the associated functionality was removed.

@tiagodaraujo
Copy link
Author

Hi @nr-ahemsath, thanks for address this issue quickly. Does the next release have an estimated date?

@nr-ahemsath
Copy link
Member

We should be ready to do a release sometime next week.

@tiagodaraujo
Copy link
Author

Hi @nr-ahemsath,
I upgraded the NewRelic.Agent.Api to the latest version. Did some traffic on my application, extracted a memory dump and I see the same MetricNameService transactions in memory. It's weird because I see in your code that you delete them. I confirmed dll version in my application and is the 8.35.0. I restarted my server and sill the same behaviour. Do I need to update something else in the server?
Thank you

@nr-ahemsath
Copy link
Member

@tiagodaraujo Did you also update the agent to version 8.35.0? The relevant code changes were in the agent, not in the API. (The API assembly contains stub methods which get rewritten at runtime by the agent.)

@tiagodaraujo
Copy link
Author

Oh, didn't know. I will try to upgrade the agent on the server. Thank you.

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

Successfully merging a pull request may close this issue.

2 participants