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

Regex is blocking thread #2703

Closed
modestaspruckus opened this issue Nov 6, 2024 · 4 comments · May be fixed by #2714
Closed

Regex is blocking thread #2703

modestaspruckus opened this issue Nov 6, 2024 · 4 comments · May be fixed by #2714
Assignees

Comments

@modestaspruckus
Copy link

modestaspruckus commented Nov 6, 2024

[NOTE]: # sql query parser is blocking main thread

Description

We're using latest newrelic package ^12.6.0 and noticed performance issues with enabled apm agent. Node profiling shows that issue relies on sql parser regex. Issue occurs only with enabled newrelic package.

Expected Behavior

Try to avoid using heavy regex

node profiling results

   ticks parent  name
  115723   50.4%  RegExp: \/\\*.*?\\*\/
  115719  100.0%    JS: *parseSql /app/node_modules/newrelic/lib/db/query-parsers/sql.js:29:35
  115719  100.0%      JS: *queryRecorder /app/node_modules/newrelic/lib/shim/datastore-shim.js:552:64
  115719  100.0%        JS: *wrapper /app/node_modules/newrelic/lib/shim/shim.js:668:26
  58027   50.1%          JS: *runInContextCb /app/node_modules/newrelic/lib/shim/shim.js:1178:26
  58027  100.0%            JS: *run node:async_hooks:332:6
  57692   49.9%          JS: ^<anonymous> /app/node_modules/mysql2/lib/pool.js:144:24
  57692  100.0%            JS: *runInContextCb /app/node_modules/newrelic/lib/shim/shim.js:1178:26

Steps to Reproduce

Issue occurs only when specific json is saved to database e.g. having many \\\\ characters inside (attaching payload example)
scratch_86.json

Your Environment

node@20
mysql2 package
[email protected]

Additional context

@workato-integration
Copy link

@jsumners-nr
Copy link
Contributor

@modestaspruckus thank you for the report. I am looking into this issue. Unfortunately, it doesn't look like we have a way to disable query parsing individually. In the meantime, can you provide me with an SQL statement that would fail? Basically, what does a basic statement look like that would include the provided JSON as part of it?

@jsumners-nr
Copy link
Contributor

@modestaspruckus are you able to provide the additional context I have requested?

@jsumners-nr
Copy link
Contributor

I am closing this as not reproducible due to lack of response. If you are able to provide the requested information, please do and we can re-open the issue. If you try the changes in #2714 and find that the solve the issue, please report that as well.

@jsumners-nr jsumners-nr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
@github-project-automation github-project-automation bot moved this from In progress: Issues being worked on to Done: Issues recently completed in Node.js Engineering Board Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done: Issues recently completed
Development

Successfully merging a pull request may close this issue.

2 participants