Tencent/matrix · error · NullPointerException
LeakProcessor not found!!!
Error message
LeakProcessor not found!!!
What it means
ActivityRefWatcher's polling loop, upon confirming a destroyed activity is a suspected leak, hands it to mLeakProcessor. If no processor was configured (it is optional at build time), it throws NullPointerException('LeakProcessor not found!!!') to fail fast rather than silently ignoring leaks.
Solutions
- Configure a LeakProcessor via the builder/factory (e.g. DefaultLeakProcessor) before starting the watcher.
- If you only want detection without processing, install a no-op LeakProcessor instead of leaving it null.
- Verify which Matrix flavor/dependency you use and align the watcher factory with it.
- Update Matrix version if your flavor previously shipped a default processor.
Example fix
// before ActivityRefWatcher watcher = new ActivityRefWatcher(...); // no processor // after watcher.setLeakProcessor(new DefaultLeakProcessor(new DefaultHeapDump()));
Defensive patterns
Strategy: validation
Validate before calling
if (watcher.getLeakProcessor() == null) {
watcher.setLeakProcessor(new DefaultLeakProcessor(new DefaultHeapDump()));
} Try / catch
try {
watcher.start();
} catch (NullPointerException e) {
Log.e(TAG, "LeakProcessor missing; reconfigure watcher", e);
} Prevention
- Always register a LeakProcessor (or explicit no-op) in the builder/factory
- Set the processor before starting the watcher
- Align the processor config with the Matrix flavor in use
When it happens
Trigger: A leak is detected (destroyed activity weakly reachable after destroy+GC polling) while the watcher was built without setLeakProcessor / with factory producing null processor, and mDumpHprofMode flow reaches the processing step.
Common situations: Using the no-hprof flavor of Matrix or a custom builder config that omits the LeakProcessor while dump/processing mode is enabled; calling setLeakProcessor after the watcher started; reflection/dynamic feature setups dropping the processor binding.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- Custom library loader is not supported in isolate process…
- closer == null
- Unabled to find destroy activity info class with name:
- Could not find weak reference with key
- sBuffer == null
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/83a421974c9d08e7.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-android/src/main/java/com/tencent/matrix/resource/watcher/ActivityRefWatcher.java:295
}
++destroyedActivityInfo.mDetectedCount;
if (destroyedActivityInfo.mDetectedCount < mMaxRedetectTimes
&& !mResourcePlugin.getConfig().getDetectDebugger()) {
// Although the sentinel tell us the activity should have been recycled,
// system may still ignore it, so try again until we reach max retry times.
MatrixLog.i(TAG, "activity with key [%s] should be recycled but actually still exists in %s times, wait for next detection to confirm.",
destroyedActivityInfo.mKey, destroyedActivityInfo.mDetectedCount);
triggerGc();
continue;
}
MatrixLog.i(TAG, "activity with key [%s] was suspected to be a leaked instance. mode[%s]", destroyedActivityInfo.mKey, mDumpHprofMode);
if (mLeakProcessor == null) {
throw new NullPointerException("LeakProcessor not found!!!");
}
if (mLeakProcessor.process(destroyedActivityInfo)) {
MatrixLog.i(TAG, "the leaked activity [%s] with key [%s] has been processed. stop polling", destroyedActivityInfo.mActivityName, destroyedActivityInfo.mKey);
infoIt.remove();
}
}
return Status.RETRY;
}
};
public BaseLeakProcessor getLeakProcessor() {
return mLeakProcessor;
}
public ResourcePlugin getResourcePlugin() {
return mResourcePlugin;View on GitHub (pinned to 3b8293bd65)