pinpoint-apm/pinpoint · warning

bytecode read fail scanner

Error message

bytecode read fail scanner:{} path:{}

What it means

ASMClassNodeAdapter.readStream logs this warning when reading the raw bytecode of a class from the plugin scanner's InputStream fails with an IOException. The adapter returns null, so callers treat the class as unreadable and typically skip transforming that class. It usually indicates a corrupted jar/class file, a truncated stream, or an I/O problem opening the resource inside a jar.

Solutions

  1. Verify the jar containing the class is not corrupted (jar tf / unzip -t) and rebuild it if needed
  2. Ensure the application is not overwriting/deleting jars while the agent runs; restart the JVM after redeploying
  3. Check the storage holding the jar (local disk vs NFS) for I/O errors
  4. Exclude the problematic jar/class from plugin transformation if its instrumentation is not required
Defensive patterns

Strategy: try-catch

Validate before calling

// before scanning, validate the jar is readable:
try (JarFile jf = new JarFile(path)) { if (jf.getJarEntry(classPath) == null) skip(); }

Try / catch

try { return IOUtils.toByteArray(stream); } catch (IOException e) { logger.warn("bytecode read fail scanner:{} path:{}", scanner, classPath); return null; }

Prevention

When it happens

Trigger: scanner.openStream(classPath) returned a valid stream but IOUtils.toByteArray hit an IOException mid-read — broken/truncated jar entry, corrupted class file, disk or network filesystem errors, or jar being modified concurrently while the agent reads it.

Common situations: Hot-deploy/overwriting an application jar while the Pinpoint agent lazily reads classes from it; corrupted fat-jar produced by a failed build; reading classes over a flaky network mount (NFS); zip64 or malformed entries in shaded jars.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClassNodeAdapter.java:97

    private static int getParsingOption(boolean skipCode) {
        if (skipCode) {
            return ClassReader.SKIP_CODE;
        } else {
            return 0;
        }
    }

    private static byte[] readStream(String classPath, ClassInputStreamProvider pluginClassInputStreamProvider, ProtectionDomain protectionDomain, ClassLoader classLoader) {

        final Scanner scanner = ClassScannerFactory.newScanner(protectionDomain);
        if (scanner != null) {
            try {
                final InputStream stream = scanner.openStream(classPath);
                if (stream != null) {
                    try {
                        return IOUtils.toByteArray(stream);
                    } catch (IOException e) {
                        logger.warn("bytecode read fail scanner:{} path:{}", scanner, classPath);
                        return null;
                    }
                }
            } finally {
                scanner.close();
            }
        }

        final InputStream in = pluginClassInputStreamProvider.getResourceAsStream(classLoader, classPath);
        if (in != null) {
            try {
                return IOUtils.toByteArray(in);
            } catch (IOException e) {
                logger.warn("bytecode read fail path:{}", classPath);
                return null;
            }
        }
        return null;

View on GitHub (pinned to 744c3d3075)