pinpoint-apm/pinpoint · error

INTERNAL_SERVER_ERROR

INTERNAL_SERVER_ERROR

Error message

Failed to handle applicationName={}, sqlUidMetaData={}

What it means

Catch-all failure path of GrpcSqlUidMetaDataHandler.handleSqlUidMetaData. It inserts the SqlUidMetaDataBo into every configured SqlUidMetaDataService backend; any per-backend exception is logged at WARN ('Failed to handle applicationName={}, sqlUidMetaData={}', details suppressed, stack trace appended), flips the overall result to false, and the handler returns PResults.INTERNAL_SERVER_ERROR to the agent. The outer catch handles parse/mapping failures identically.

Source

Thrown at collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/GrpcSqlUidMetaDataHandler.java:78

        }

        try {
            ServiceUid serviceUid = header.getServiceUid().get();
            if (serviceUid == null || ServiceUid.UNKNOWN.equals(serviceUid) || ServiceUid.ERROR.equals(serviceUid)) {
                logger.warn("Service not found. serviceName={}, serviceUid={}, applicationName={}, agentId={}",
                        header.getServiceName(), serviceUid, header.getApplicationName(), header.getAgentId());
                return PResults.serviceNotFound(header.getServiceName());
            }

            SqlUidMetaDataBo sqlUidMetaDataBo = mapSqlUidMetaDataBo(header, sqlUidMetaData, serviceUid);

            boolean result = true;
            for (SqlUidMetaDataService sqlUidMetaDataService : sqlUidMetaDataServices) {
                try {
                    sqlUidMetaDataService.insert(sqlUidMetaDataBo);
                } catch (Exception e) {
                    // Avoid detailed error messages.
                    logger.warn("Failed to handle applicationName={}, sqlUidMetaData={}", header.getApplicationName(), MessageFormatUtils.debugLog(sqlUidMetaData), e);
                    result = false;
                }
            }

            return newResult(result);
        } catch (Exception e) {
            logger.warn("Failed to handle applicationName={}, sqlUidMetaData={}", header.getApplicationName(), MessageFormatUtils.debugLog(sqlUidMetaData), e);
            return PResults.INTERNAL_SERVER_ERROR;
        }
    }

    private static SqlUidMetaDataBo mapSqlUidMetaDataBo(ServerHeader agentInfo, PSqlUidMetaData sqlUidMetaData, ServiceUid serviceUid) {
        final String agentId = agentInfo.getAgentId();
        final long agentStartTime = agentInfo.getAgentStartTime();
        final String applicationName = agentInfo.getApplicationName();
        final byte[] sqlUid = sqlUidMetaData.getSqlUid().toByteArray();
        final String sql = sqlUidMetaData.getSql();

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Check the collector WARN log 'Failed to handle applicationName={}, sqlUidMetaData=' for the stack trace naming the failing backend.
  2. Apply the sqlUid feature's HBase schema scripts (SqlUidMetaData table) and confirm HBase connectivity/health.
  3. If the environment does not intend to use sqlUid, disable uid-based sql metadata on agents/collector instead of letting writes fail.
  4. Validate the logged sqlUidMetaData payload for null/invalid fields and fix or align the agent version generating it.
  5. Restart agents after storage recovery so sqlUid metadata is re-sent.

Example fix

// before
sqlUidMetaDataService.insert(sqlUidMetaDataBo); // throws -> result=false -> INTERNAL_SERVER_ERROR

// after: ensure the uid table/schema exists for the deployed version
// hbase shell: exists 'SqlUidMetaData' || apply pinoint sqlUid hbase scripts
try {
    sqlUidMetaDataService.insert(sqlUidMetaDataBo);
} catch (Exception e) {
    logger.warn("Failed to handle applicationName={}, sqlUidMetaData={}", header.getApplicationName(), MessageFormatUtils.debugLog(sqlUidMetaData), e);
    result = false;
}
Defensive patterns

Strategy: validation

Validate before calling

// ensure the sqlUid feature is fully provisioned before agents send uid metadata
// hbase shell: exists 'SqlUidMetaData'
if (header == null || header.getApplicationName() == null)
    throw new IllegalArgumentException("applicationName is required for sqlUid metadata");
if (sqlUidMetaData == null)
    throw new IllegalArgumentException("sqlUidMetaData payload is required");

Type guard

// Java: narrow valid uid metadata requests
private static boolean isUsableSqlUidMetaData(PS_MetaData m) {
    return m != null && m.getSqlUidMetaData() != null && m.getHeader() != null;
}

Try / catch

try {
    PResult result = handler.handleSqlUidMetaData(header, sqlUidMetaData);
    if (!PResults.isSuccess(result)) {
        // uid metadata is re-sent by agents; retry with capped backoff
        backoffRetry(() -> handler.handleSqlUidMetaData(header, sqlUidMetaData));
    }
} catch (StatusRuntimeException e) {
    logger.warn("sqlUidMetaData RPC failed: {}", e.getStatus(), e);
}

Prevention

When it happens

Trigger: A PS_MetaData (sqlUid) request whose insert throws in one or more SqlUidMetaDataService instances — HBase write failure, null applicationName in header, invalid sqlUid binding — or an exception in the outer mapping block of handleSqlUidMetaData.

Common situations: HBase unavailable or SqlUidMetaData table absent (sqlUid feature enabled on agents/collector but its table/schema scripts not applied); version skew where agents send uid-based sql metadata to a collector/table not prepared for it; one of several metadata backends down while others succeed; oversized or malformed sql strings.

Related errors


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