{"record":{"id":"587feaf1d439690c","repo":"pinpoint-apm/pinpoint","slug":"sequencelimit-max-sequence","errorCode":null,"errorMessage":"${sequenceLimit} > MAX_SEQUENCE","messagePattern":"(.+?) > MAX_SEQUENCE","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/filter/SequenceSpanEventFilter.java","lineNumber":42,"sourceCode":"/**\n * @author Woonduk Kang(emeroad)\n */\npublic class SequenceSpanEventFilter implements SpanEventFilter {\n\n    private final Logger logger = LogManager.getLogger(this.getClass());\n\n    public static final int MAX_SEQUENCE = Short.MAX_VALUE;\n    public static final int DEFAULT_SEQUENCE_LIMIT = 1024*10;\n\n    private final int sequenceLimit;\n\n    public SequenceSpanEventFilter() {\n        this(DEFAULT_SEQUENCE_LIMIT);\n    }\n\n    public SequenceSpanEventFilter(int sequenceLimit) {\n        if (sequenceLimit > MAX_SEQUENCE) {\n            throw new IllegalArgumentException(sequenceLimit + \" > MAX_SEQUENCE\");\n        }\n        this.sequenceLimit = sequenceLimit;\n    }\n\n    @Override\n    public boolean filter(SpanEventBo spanEventBo) {\n        if (spanEventBo == null) {\n            return REJECT;\n        }\n        final int sequence = spanEventBo.getSequence();\n        if (sequence < 0 || sequence > sequenceLimit) {\n            if (logger.isTraceEnabled()) {\n                logger.trace(\"discard spanEvent:{}\", spanEventBo);\n            }\n            return REJECT;\n        }\n        return ACCEPT;\n    }","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/filter/SequenceSpanEventFilter.java#L24-L60","documentation":"SequenceSpanEventFilter limits filtering to span events whose sequence is below MAX_SEQUENCE (the maximum representable span-event sequence). A sequenceLimit greater than MAX_SEQUENCE can never be honored, so the constructor rejects it eagerly with this IllegalArgumentException.","triggerScenarios":"Instantiating SequenceSpanEventFilter (or the no-arg variant if DEFAULT_SEQUENCE_LIMIT were ever misconfigured) with a sequenceLimit exceeding MAX_SEQUENCE — e.g. from config that reads a user-supplied limit without clamping.","commonSituations":"Setting an unbounded custom span event filter limit in collector/Web configuration; misreading the constant as millis or another unit; copy-pasted tuning values from documentation for a different version.","solutions":["Lower the configured sequenceLimit to at most MAX_SEQUENCE","Clamp the parsed config value with Math.min(value, MAX_SEQUENCE) before constructing the filter","Remove the custom override and use the default constructor (DEFAULT_SEQUENCE_LIMIT)"],"exampleFix":"// before\nnew SequenceSpanEventFilter(config.getSequenceLimit()); // may exceed MAX_SEQUENCE\n// after\nint limit = Math.min(config.getSequenceLimit(), SequenceSpanEventFilter.MAX_SEQUENCE);\nnew SequenceSpanEventFilter(limit);","handlingStrategy":"validation","validationCode":"int limit = Math.min(configuredLimit, SequenceSpanEventFilter.MAX_SEQUENCE);\nSpanEventFilter filter = new SequenceSpanEventFilter(limit);","typeGuard":"boolean isValidSequenceLimit(int limit) {\n    return limit <= SequenceSpanEventFilter.MAX_SEQUENCE;\n}","tryCatchPattern":"try {\n    filter = new SequenceSpanEventFilter(configuredLimit);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"sequenceLimit too high, using default\", e);\n    filter = new SequenceSpanEventFilter();\n}","preventionTips":["Clamp user/config-supplied limits to MAX_SEQUENCE before constructing the filter","Use the no-arg default constructor unless a smaller limit is intentional","Document the unit and ceiling of the config property next to its definition"],"tags":["java","configuration","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}