apache/skywalking · error · IllegalArgumentException

wrong stack data

Error message

wrong stack data

What it means

ProfileStack.deserialize() converts a stored ProfileThreadSnapshotRecord into a ProfileStack by parsing record.getStackBinary() as a ThreadStack protobuf message. If the bytes are not a valid protobuf ThreadStack, parseFrom throws InvalidProtocolBufferException, which is rethrown as IllegalArgumentException('wrong stack data'). This occurs during profile analysis, i.e. when a user opens a profiling snapshot in the UI after the data was already persisted — the corruption happened upstream (agent or storage), not at query time.

Source

Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/analyze/ProfileStack.java:45

import org.apache.skywalking.apm.network.language.profile.v3.ThreadStack;
import org.apache.skywalking.oap.server.core.profiling.trace.ProfileThreadSnapshotRecord;

/**
 * Deserialize from {@link ProfileThreadSnapshotRecord}
 */
@Data
public class ProfileStack implements Comparable<ProfileStack> {

    private int sequence;
    private long dumpTime;
    private List<String> stack;

    public static ProfileStack deserialize(ProfileThreadSnapshotRecord record) {
        ThreadStack threadStack = null;
        try {
            threadStack = ThreadStack.parseFrom(record.getStackBinary());
        } catch (InvalidProtocolBufferException e) {
            throw new IllegalArgumentException("wrong stack data");
        }

        // build data
        ProfileStack stack = new ProfileStack();
        stack.sequence = record.getSequence();
        stack.dumpTime = record.getDumpTime();
        stack.stack = threadStack.getCodeSignaturesList();

        return stack;
    }

    @Override
    public int compareTo(ProfileStack o) {
        return Ints.compare(sequence, o.sequence);
    }

    @Override
    public boolean equals(Object o) {

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Check the agent and OAP versions match (same apm-network proto for ProfileThreadSnapshot) — realign versions and re-capture the profile.
  2. Start a new profiling task and verify the new snapshot analyzes; if it does, the old records were written by a mismatched version and can be ignored/deleted.
  3. If new snapshots also fail, inspect the raw record (stackBinary length/content) in storage and check for truncated writes or disk issues.
  4. Verify no mixed OAP versions in the cluster are processing the same profiling data.
Defensive patterns

Strategy: try-catch

Try / catch

try { ProfileStack stack = ProfileStack.deserialize(record); } catch (IllegalArgumentException e) { if ("wrong stack data".equals(e.getMessage())) { log.warn("skipping corrupt snapshot seq={}", record.getSequence()); return Optional.empty(); } throw e; }

Prevention

When it happens

Trigger: Querying/analyzing an eBPF- or JVM-thread profile whose stored stackBinary fails ThreadStack.parseFrom — truncated bytes, wrong schema version between agent and OAP, or storage-level corruption/mis-serialization.

Common situations: Agent/OAP version mismatch after upgrading one side (proto schema drift); mixed-protocol cluster writing snapshots with different proto definitions; partial writes or compression misconfiguration in storage; reading old snapshots after a schema change.

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/2d0c204a971e8458. Report an issue: GitHub.