You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cause serious performance degradation in case of node used with sourcemaps.
For example dataloader fail on reading list of N nodes can cause N*100ms delay.
Explanation:
Modern nodejs has sourcemaps support via --enable-source-maps flag.
In current nodejs access to error.stack object is lazy, so until you read it where are no additional logic called to prepare stack traces i.e. Error.prepareStackTrace
With sourcemaps enabled node resolution algorithm for trace is not chip and on big projects costs like 100ms to build trace using sourcemaps. (see nodejs prepare stack trace)
For example on reading list of 30 items in case of dataloader fails we have 3000ms delay because of reading stack at that lines.
I found that for unknown reason Object.defineProperty cause prepareStackTrace to be called. But setting this.stack = null; before solves the issue.
Have no idea why.
The text was updated successfully, but these errors were encountered:
The same thing happened to us on node18 on the local/dev machine and production console.
We switched to node20 and the performance issue was resolved on the local/dev machine but it still has the same issue on production. we decided to remove the --enable-source-maps node option for now.
This code lines
graphql-js/src/error/GraphQLError.js
Lines 189 to 196 in 16009cb
For example dataloader fail on reading list of N nodes can cause N*100ms delay.
Explanation:
Modern nodejs has sourcemaps support via
--enable-source-maps
flag.In current nodejs access to error.stack object is lazy, so until you read it where are no additional logic called to prepare stack traces i.e.
Error.prepareStackTrace
With sourcemaps enabled node resolution algorithm for trace is not chip and on big projects costs like 100ms to build trace using sourcemaps. (see nodejs prepare stack trace)
For example on reading list of 30 items in case of dataloader fails we have 3000ms delay because of reading stack at that lines.
I found that for unknown reason Object.defineProperty cause prepareStackTrace to be called. But setting
this.stack = null;
before solves the issue.Have no idea why.
The text was updated successfully, but these errors were encountered: