Skip to content

attribute: investigate and fix unexpected panic in unreachable code paths#8062

Open
NETIZEN-11 wants to merge 2 commits intoopen-telemetry:mainfrom
NETIZEN-11:main
Open

attribute: investigate and fix unexpected panic in unreachable code paths#8062
NETIZEN-11 wants to merge 2 commits intoopen-telemetry:mainfrom
NETIZEN-11:main

Conversation

@NETIZEN-11
Copy link

@NETIZEN-11 NETIZEN-11 commented Mar 15, 2026

Overview

This PR investigates the panic occurring in code paths that are assumed to be unreachable in the attribute handling logic.

The panic indicates that a supposedly unreachable case can actually occur during runtime, which suggests a bug in the attribute processing or hashing logic.

Problem

Currently, certain parts of the attribute implementation rely on panic() when encountering cases that are assumed to be unreachable. However, when unexpected attribute values or types propagate into these paths, the program may crash.

This behavior was reported in issue #8047.

Changes

  • Analyzed the attribute handling logic to identify why the unreachable case is triggered.
  • Updated the logic to ensure that valid attribute types are handled correctly before reaching the panic condition.
  • Preserved panic behavior for truly invalid internal states while preventing legitimate runtime paths from triggering it.

Testing

  • Verified that valid attribute types continue to work as expected.
  • Confirmed that legitimate execution paths no longer reach the panic condition.

Fixes: #8047

- Replace panic with graceful handling in hashKV function
- Treat unknown types as EMPTY to maintain hash consistency
- Add comprehensive tests to verify the fix
- Prevent crashes from corrupted data or future type additions

Fixes issue open-telemetry#8047: panic in places that should be unreachable
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 15, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: NETIZEN-11 / name: NITESH SINGH (97b04e7)

@dmathieu dmathieu added the blocked:CLA Waiting on CLA to be signed before progress can be made label Mar 16, 2026
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the opposite of what the issue is about

@NETIZEN-11 NETIZEN-11 requested a review from pellared March 17, 2026 04:17
@NETIZEN-11 NETIZEN-11 changed the title attribute: handle unknown attribute types gracefully instead of panic attribute: investigate and fix unexpected panic in unreachable code paths Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked:CLA Waiting on CLA to be signed before progress can be made

Projects

None yet

Development

Successfully merging this pull request may close these issues.

attribute: panic in places that should be unreachable

3 participants