| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
the number of frames here should already be the <= stack trace limit. as I understand it our code just provides a lower bound. |
Sorry, something went wrong.
|
TBH this does not sound like a good idea since v8 is considering removing these non-standard APIs: https://bugs.chromium.org/p/v8/issues/detail?id=6974 By adding support in our internal error printers we are sort of encouraging people to use it - also in the case of --trace-sync-io, it is more of an implementation detail that we use the error-related API to print things. It is especially tricky to try handling these hooks ourselves considering we also made the mistake (?) of always respecting the Error.prepareStackTrace from the main context. |
Sorry, something went wrong.
There was a problem hiding this comment.
This is not a valid .ToLocalChecked(), can you handle errors here (and for the .ToChecked() below, as @lundibundi pointed out)? Ideally, this block here would also be wrapped in a v8::TryCatch in order to swallow these errors from trying to get the stack trace
Sorry, something went wrong.
|
@joyeecheung Yes, the API Error.stackTraceLimit itself is not standard. The idea of PR is preventing hard-coding numbers in the codebase. Either the limit shall be referred from the global Error.stackTraceLimit or just stored in the node::Environment, it would sound good to me. Since we've already used Error.stackTraceLimit multiple places, I'd think it might be fine at the time. We could remove the usage on Error.stackTraceLimit later if it's time to deprecate the API. Anyway, if anyone has any strong opinion on this idea, it also sounds good to me if the stacktrace limit shall be referred from some internal store. |
Sorry, something went wrong.
|
@legendecas Adding something like Environment::kStackTraceLimit SGTM. I think most internal uses of Error.stackTraceLimit are only optimizations to avoid the overhead of generating a stack trace (with the pattern of setting it to 0 or 1, creating an error, and then restoring the limit), which I don't know if is actually effective at this point considering stack trace generation in v8 is lazy. |
Sorry, something went wrong.
There was a problem hiding this comment.
I guess LGTM although I’d have preferred the solution that reads Error.stackTraceLimit
Sorry, something went wrong.
|
@joyeecheung @lundibundi may I ask for your reviews on the PR since you have interests in preventing usage on the unstandardized Error.stackTraceLimit? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Though I would prefer the previous Error.stackTraceLimit version as it is useful to be able to control the C++-land stack size and to have it consistent with the JS-land. Regarding possible removal of the API, I think it is not much of an issue as this code will only be in once place and we can always replace it with a constant in a few days' time at max.
Also, the PR's name should be changed accordingly to the code.
Sorry, something went wrong.
It's true that in most cases stack trace wasn't very long to exceed the limit. Still, it is possible. |
Sorry, something went wrong.
I meant to have one function like get_stack_size or compute_stack_size and then use it everywhere. Then we can easily just make this function return 10; if needed. |
Sorry, something went wrong.
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land.
Sorry, something went wrong.
|
I agree with @addaleax and @lundibundi that the former solution seemed better. If the property will ever be removed, it's definitely possible to react to it appropriately. So far it's not likely that this is happening anytime soon. |
Sorry, something went wrong.
|
I would not oppose to a solution that allows the JS land to configure the stack trace limit, but I would be -1 if this is Error.stackTraceLimit for the following reasons (other than it's non-standard):
|
Sorry, something went wrong.
Sorry, something went wrong.
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land. PR-URL: #30752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land. PR-URL: #30752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land. PR-URL: #30752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land. PR-URL: #30752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Refer to Environment::stack_trace_limit() while printing fresh stacktraces in c++ land. PR-URL: #30752 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
| Back | FazBrowse Home | New Git URL |
Refer to Environment::stack_trace_limit() while printing fresh
stacktraces in c++ land.
Checklist