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

TracePage crash in browser #821

Closed
zimv opened this issue Sep 29, 2021 · 1 comment · Fixed by #823
Closed

TracePage crash in browser #821

zimv opened this issue Sep 29, 2021 · 1 comment · Fixed by #823

Comments

@zimv
Copy link
Contributor

zimv commented Sep 29, 2021

Describe the bug
Some data of interface [host]/api/traces/:id response will cause an endless loop, so the trace page that [host]/trace/:id will crash in browser. It's here, https://github.com/jaegertracing/jaeger-ui/blob/v1.16.0/packages/jaeger-ui/src/utils/span-ancestor-ids.tsx#L35.

To Reproduce
Steps to reproduce the behavior:

  1. Open url: [host]/trace/:id
  2. The interface [host]/api/traces/:id returns the following
{"data":[{"traceID":"4fad4dd4cf61528f","spans":[{"traceID":"4fad4dd4cf61528f","spanID":"4503f0398561528f","flags":1,"operationName":"/med.xuser.v1.Auth/AuthCheck","references":[{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"0f609f77cf61528f"},{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"4503f0398561528f"}],"startTime":1632800689665976,"duration":2725,"tags":[{"key":"region","type":"string","value":"cd"},{"key":"zone","type":"string","value":"cd001"},{"key":"hostname","type":"string","value":"med-xuser-prod-9ed9c372-55d679bfc5-x484j"},{"key":"ip","type":"string","value":"172.20.9.250"},{"key":"span.kind","type":"string","value":"server"},{"key":"legacy.address","type":"string","value":"172.20.16.90:51958"},{"key":"internal.span.format","type":"string","value":"proto"}],"logs":[],"processID":"p1","warnings":["invalid parent span IDs=0f609f77cf61528f; skipping clock skew adjustment"]},{"traceID":"4fad4dd4cf61528f","spanID":"3355d32c8561528f","flags":1,"operationName":"Redis:HGETALL","references":[{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"4503f0398561528f"},{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"3355d32c8561528f"}],"startTime":1632800689666008,"duration":937,"tags":[{"key":"region","type":"string","value":"cd"},{"key":"zone","type":"string","value":"cd001"},{"key":"hostname","type":"string","value":"med-xuser-prod-9ed9c372-55d679bfc5-x484j"},{"key":"ip","type":"string","value":"172.20.9.250"},{"key":"span.kind","type":"string","value":"client"},{"key":"span.kind","type":"string","value":"client"},{"key":"component","type":"string","value":"library/cache/redis"},{"key":"peer.service","type":"string","value":"redis"},{"key":"peer.address","type":"string","value":"r-bp186dd0e95850d4865.redis.rds.aliyuncs.com:6379"},{"key":"db.statement","type":"string","value":"HGETALL us:passport:app:140272979__Znbt5OF9Ba8nAlsVucRlzmdzEf1NSeJkP5HswN4xMwhey2q206XRvyZI3rOX9rpj"},{"key":"internal.span.format","type":"string","value":"proto"}],"logs":[],"processID":"p1","warnings":null},{"traceID":"4fad4dd4cf61528f","spanID":"5b090f588561528f","flags":1,"operationName":"Redis:EXPIRE","references":[{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"4503f0398561528f"},{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"5b090f588561528f"}],"startTime":1632800689667005,"duration":782,"tags":[{"key":"region","type":"string","value":"cd"},{"key":"zone","type":"string","value":"cd001"},{"key":"hostname","type":"string","value":"med-xuser-prod-9ed9c372-55d679bfc5-x484j"},{"key":"ip","type":"string","value":"172.20.9.250"},{"key":"span.kind","type":"string","value":"client"},{"key":"span.kind","type":"string","value":"client"},{"key":"component","type":"string","value":"library/cache/redis"},{"key":"peer.service","type":"string","value":"redis"},{"key":"peer.address","type":"string","value":"r-bp186dd0e95850d4865.redis.rds.aliyuncs.com:6379"},{"key":"db.statement","type":"string","value":"EXPIRE us:passport:app:140272979__Znbt5OF9Ba8nAlsVucRlzmdzEf1NSeJkP5HswN4xMwhey2q206XRvyZI3rOX9rpj"},{"key":"internal.span.format","type":"string","value":"proto"}],"logs":[],"processID":"p1","warnings":null},{"traceID":"4fad4dd4cf61528f","spanID":"2fc7c8b28561528f","flags":1,"operationName":"Redis:HMSET","references":[{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"4503f0398561528f"},{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"2fc7c8b28561528f"}],"startTime":1632800689667819,"duration":799,"tags":[{"key":"region","type":"string","value":"cd"},{"key":"zone","type":"string","value":"cd001"},{"key":"hostname","type":"string","value":"med-xuser-prod-9ed9c372-55d679bfc5-x484j"},{"key":"ip","type":"string","value":"172.20.9.250"},{"key":"span.kind","type":"string","value":"client"},{"key":"span.kind","type":"string","value":"client"},{"key":"component","type":"string","value":"library/cache/redis"},{"key":"peer.service","type":"string","value":"redis"},{"key":"peer.address","type":"string","value":"r-bp186dd0e95850d4865.redis.rds.aliyuncs.com:6379"},{"key":"db.statement","type":"string","value":"HMSET us:passport:app:140272979__Znbt5OF9Ba8nAlsVucRlzmdzEf1NSeJkP5HswN4xMwhey2q206XRvyZI3rOX9rpj"},{"key":"internal.span.format","type":"string","value":"proto"}],"logs":[],"processID":"p1","warnings":null},{"traceID":"4fad4dd4cf61528f","spanID":"7ebf11d6d161528f","flags":1,"operationName":"/chronic.patient.service.v1.CommonModule/GetOldGroupId","references":[{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"605f3b71cf61528f"},{"refType":"CHILD_OF","traceID":"4fad4dd4cf61528f","spanID":"7ebf11d6d161528f"}],"startTime":1632800689669304,"duration":1476,"tags":[{"key":"region","type":"string","value":"cd"},{"key":"zone","type":"string","value":"cd001"},{"key":"hostname","type":"string","value":"chronic-patient-service-prod-fab2d249-5bf6975954-djnm2"},{"key":"ip","type":"string","value":"172.20.15.230"},{"key":"span.kind","type":"string","value":"server"},{"key":"legacy.address","type":"string","value":"172.20.16.90:39990"},{"key":"internal.span.format","type":"string","value":"proto"}],"logs":[],"processID":"p2","warnings":["invalid parent span IDs=605f3b71cf61528f; skipping clock skew adjustment"]}],"processes":{"p1":{"serviceName":"med-xuser","tags":[{"key":"component","type":"string","value":"library/cache/redis"},{"key":"db.statement","type":"string","value":"HGETALL us:passport:web:142123008__rBJjFngtwRhva5iymUEwdZpDR2NhOVQUF00X4LWCmGTn2Xg4G8s1Su5DKrMxa1P9"},{"key":"hostname","type":"string","value":"med-xuser-prod-9ed9c372-55d679bfc5-x484j"},{"key":"ip","type":"string","value":"172.20.9.250"},{"key":"peer.address","type":"string","value":"r-bp186dd0e95850d4865.redis.rds.aliyuncs.com:6379"},{"key":"peer.service","type":"string","value":"redis"},{"key":"region","type":"string","value":"cd"},{"key":"span.kind","type":"string","value":"client"},{"key":"span.kind","type":"string","value":"client"},{"key":"zone","type":"string","value":"cd001"}]},"p2":{"serviceName":"chronic-patient-service","tags":[{"key":"hostname","type":"string","value":"chronic-patient-service-prod-fab2d249-5bf6975954-djnm2"},{"key":"ip","type":"string","value":"172.20.15.230"},{"key":"legacy.address","type":"string","value":"172.20.1.186:8000"},{"key":"legacy.comment","type":"string","value":""},{"key":"region","type":"string","value":"cd"},{"key":"span.kind","type":"string","value":"client"},{"key":"zone","type":"string","value":"cd001"}]}},"warnings":null}],"total":0,"limit":0,"offset":0,"errors":null}
  1. while endless loop
while (ref) {
    ancestorIDs.push(ref.spanID);
    ref = getFirstAncestor(ref);
}
  1. browser crash

Expected behavior
Dont crash.

Screenshots
image

Version (please complete the following information):

  • Jaeger v1.24.0
  • Jaeger UI v1.16.0

What troubleshooting steps did you try?
Add condition judgment

Additional context
In some cases, the response data is abnormal. But it shouldn't crash, I hope I can still see the data.

@zimv
Copy link
Contributor Author

zimv commented Jan 12, 2022

#823

I hope it can be solved as soon as possible!

yurishkuro added a commit that referenced this issue Oct 15, 2023
Signed-off-by: zimv <472953586@qq.com>
## Which problem is this PR solving?
* Resolves #821

## Short description of the changes
- Add condition judgment in `getFirstAncestor`
```
function getFirstAncestor(span: Span): Span | TNil {
  return _get(
    _find(
      span.references,
      ({ span: ref, refType }) =>
        ref &&
        ref.spanID &&
        ref.spanID !== span.spanID &&
        (refType === 'CHILD_OF' || refType === 'FOLLOWS_FROM')
    ),
    'span'
  );
}
```

Signed-off-by: zimv <472953586@qq.com>
Co-authored-by: Ruben Vargas <ruben.vp8510@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants