pinpoint-apm/pinpoint · error · IllegalStateException

CallTree corrupted

Error message

CallTree corrupted

What it means

Thrown while rebuilding the call tree of a transaction from span/spanEvent records in TransactionInfoServiceImpl. The CallTreeIterator returned a null node while walking the tree, which the code treats as proof that the in-memory CallTree structure is corrupt (broken parent/child links). This is an internal invariant violation of Pinpoint's server-side trace assembly, not something a caller can cause via input parameters.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/trace/service/TransactionInfoServiceImpl.java:324

            }
        }
        return null;
    }

    private class SpanAlignPopulate {
        private List<Record> populateSpanRecord(CallTreeIterator callTreeIterator) {
            Objects.requireNonNull(callTreeIterator, "callTreeIterator");

            final List<Record> recordList = new ArrayList<>(callTreeIterator.size() * 2);
            final RecordFactory factory = recordFactoryProvider.getRecordFactory();

            // annotation id has nothing to do with spanAlign's seq and thus may be incremented as long as they don't overlap.
            while (callTreeIterator.hasNext()) {
                final CallTreeNode node = callTreeIterator.next();
                if (node == null) {
                    logger.warn("Corrupt CallTree found : {}", callTreeIterator);
                    throw new IllegalStateException("CallTree corrupted");
                }
                final Align align = node.getAlign();

                if (metaDataFilter != null && metaDataFilter.filter(align, MetaData.API)) {
                    if (align.isSpan()) {
                        Record record = metaDataFilter.createRecord(node, factory);
                        recordList.add(record);
                    }
                    continue;
                }

                if (metaDataFilter != null && metaDataFilter.filter(align, MetaData.PARAM)) {
                    metaDataFilter.replaceAnnotationBo(align, MetaData.PARAM);
                }

                final Record record = factory.get(node);
                recordList.add(record);

                // add error category record.(span only)

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Inspect the offending transaction's span/spanEvent records (spanId, parentSpanId, seq, depth) in storage for anomalies.
  2. Upgrade Pinpoint web to a version with CallTree construction fixes; check release notes for calltree-related patches.
  3. Wrap the transaction detail rendering for that trace so a single corrupt trace returns a clear error instead of breaking the page.
  4. Re-ingest the trace from the agent if the stored span data itself is truncated or corrupt.

Example fix

// before
final CallTreeNode node = callTreeIterator.next();
final Align align = node.getAlign();
// after
final CallTreeNode node = callTreeIterator.next();
if (node == null) {
    logger.warn("Corrupt CallTree found : {}", callTreeIterator);
    continue; // or skip trace rendering with a user-facing error
}
final Align align = node.getAlign();
Defensive patterns

Strategy: try-catch

Try / catch

try {
    populateSpanRecord(recordList, callTreeIterator, ...);
} catch (IllegalStateException e) {
    logger.error("Failed to render trace {} : corrupt call tree", transactionId, e);
    throw new TransactionLookupException(transactionId, e);
}

Prevention

When it happens

Trigger: populateSpanRecord() iterates callTreeIterator.hasNext()/next(); if next() yields null the method throws IllegalStateException("CallTree corrupted") immediately.

Common situations: Corrupted or malformed span data fetched from HBase; span events with inconsistent parent/child spanIds or seq values; bugs in CallTree construction (spanAlign ordering) after collector-side data anomalies; partial reads from storage.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/1a36f697ca001afd. Report an issue: GitHub.