pinpoint-apm/pinpoint · warning

bytecode read fail path:{}

Error message

bytecode read fail path:{}

What it means

This warn is logged in ASMClassNodeAdapter.readStream when the plugin's class file bytecode cannot be read from the InputStream obtained via PluginClassInputStreamProvider.getResourceAsStream. The library throws nothing; it logs and returns null so the caller can degrade gracefully. It indicates an I/O problem (truncated jar, closed stream, IO error) while reading plugin bytecode, not a missing class.

Source

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

                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;
    }

    private static final String[] EMPTY_STRING_ARRAY = new String[0];

    private final ClassInputStreamProvider pluginInputStreamProvider;
    private final ClassLoader classLoader;
    private final ProtectionDomain protectionDomain;
    private final ClassNode classNode;
    private final boolean skipCode;

    public ASMClassNodeAdapter(final ClassInputStreamProvider pluginInputStreamProvider, final ClassLoader classLoader, ProtectionDomain protectionDomain, final ClassNode classNode) {
        this(pluginInputStreamProvider, classLoader, protectionDomain, classNode, false);
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Verify the plugin jar integrity (re-download/replace it) and restart the agent.
  2. Check that no other process rewrites the plugin directory while the agent runs.
  3. Confirm disk health and sufficient file descriptors; inspect the IOException stack trace from the same log record for the root cause.
  4. If the class is not actually needed as bytecode, ensure callers handle the null return path correctly.

Example fix

// before
return IOUtils.toByteArray(in);
// after
try {
    return IOUtils.toByteArray(in);
} catch (IOException e) {
    logger.warn("bytecode read fail path:{}", classPath, e); // log cause for diagnosis
    return null;
}
Defensive patterns

Strategy: fallback

Validate before calling

File jar = new File(pluginJarPath);
if (!jar.isFile() || jar.length() == 0) { throw new IllegalStateException("plugin jar missing/empty: " + jar); }

Try / catch

InputStream in = provider.getResourceAsStream(cl, path);
if (in == null) { return fallbackBytes(path); }
try { return IOUtils.toByteArray(in); } catch (IOException e) { log.warn("read fail {}", path, e); return null; }

Prevention

When it happens

Trigger: PluginClassInputStreamProvider.getResourceAsStream returned a non-null InputStream, but IOUtils.toByteArray(in) threw IOException while reading the plugin class resource for the given classPath.

Common situations: Corrupt or partially downloaded plugin jar in the plugin directory; jar closed/refreshed by another thread while bytecode is being read; disk or VFS I/O errors; reading from a nested jar inside a fat jar that got rewritten at startup.

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/849e5c28ac4823f7. Report an issue: GitHub.