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

tracekit computeStackTrace misses some stack traces and fails to upload stack with error #1592

Closed
hipitihop opened this issue Jun 15, 2022 · 2 comments
Labels
bug Something isn't working Good first pick

Comments

@hipitihop
Copy link

hipitihop commented Jun 15, 2022

We have found that the tracekit.computeStackTrace regular expression misses some stack traces. In some cases, it matches no stack lines, so only uploads the exception message, instead of the trace. In other cases, it misses some stack lines.

  1. Example from a local development environment where the entire stack fails to be matched:
Error: RTE Simulation
    at day8$curves$events$handler_COLON_simulate_exception (events.cljs:1060:12)
    at eval (std_interceptors.cljc:132:29)
    at re_frame$std_interceptors$fx_handler__GT_interceptor_$_fx_handler_before (std_interceptors.cljc:128:19)
    at Object.re_frame$interceptor$invoke_interceptor_fn [as invoke_interceptor_fn] (interceptor.cljc:70:6)
    at Object.re_frame$interceptor$invoke_interceptors [as invoke_interceptors] (interceptor.cljc:108:24)
    at Object.re_frame$interceptor$execute [as execute] (interceptor.cljc:199:8)
    at Object.re_frame$events$handle [as handle] (events.cljc:65:14)
    at Object.eval [as re_frame$router$IEventQueue$_process_1st_event_in_queue$arity$1] (router.cljc:179:10)
    at Object.eval [as re_frame$router$IEventQueue$_run_queue$arity$1] (router.cljc:198:44)
    at eval (router.cljc:146:64)

NOTE: in this example, this is not advanced compiled JS from a development environment, so we are not expecting actual source mapping to work, nonetheless, the stack trace should still be logged along with this exception.

  1. Example from release environment, where the stack is uploaded, however, the first two lines of the stack don't match the regex and are excluded.
Error: RTE Simulation
    at https://test.curve8.day8.com.au/client/compiled_prod/curves.js:8489:191
    at https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5329:312
    at ajb (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5302:157)
    at cjb (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5302:487)
    at kjb (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5315:435)
    at jjb (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5311:600)
    at https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5314:246
    at i_ (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5315:295)
    at b (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5312:37)
    at b.port1.onmessage (https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5129:235)

NOTE: in this example, the first two lines of the stack are skipped.

Environment

  • browser-sdk RUM & Logs version 4.11.4
  • browser Chrome Version 102.0.5005.61 (Official Build) (64-bit)
  • Host Linux Ubuntu 20.04.4 LTS
@amortemousque
Copy link
Contributor

Hello @hipitihop,

Thanks for the feedback. We'll look into it and keep you posted here.

@liywjl
Copy link
Contributor

liywjl commented Aug 4, 2022

Hello @hipitihop,

Thank you for reporting this issue. We have resolved it as of v4.16.0.

It appears that our regex struggled to handle cases where:

  • Anonymous functions are swallowed by the stack trace
    example: at https://test.curve8.day8.com.au/client/compiled_prod/curves.js:5314:246)

  • Filepath does not have a prefix to the path but rather just the target file
    example: at day8$curves$events$handler_COLON_simulate_exception (events.cljs:1060:12)

I suspect that the later might be something specific to closureScript, however I was not able to reproduce these traces myself.

Using the examples you provided I was able to add some new edge cases to our unit tests and fix the problem.

I hope this solves your issue. Don't hesitate to open another ticket if you have a specific issue related to the SDK or contact datadog support directly.

@liywjl liywjl closed this as completed Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Good first pick
Projects
None yet
Development

No branches or pull requests

3 participants