{"record":{"id":"83a421974c9d08e7","repo":"Tencent/matrix","slug":"leakprocessor-not-found","errorCode":null,"errorMessage":"LeakProcessor not found!!!","messagePattern":"LeakProcessor not found!!!","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-android/src/main/java/com/tencent/matrix/resource/watcher/ActivityRefWatcher.java","lineNumber":295,"sourceCode":"                }\n\n                ++destroyedActivityInfo.mDetectedCount;\n\n                if (destroyedActivityInfo.mDetectedCount < mMaxRedetectTimes\n                        && !mResourcePlugin.getConfig().getDetectDebugger()) {\n                    // Although the sentinel tell us the activity should have been recycled,\n                    // system may still ignore it, so try again until we reach max retry times.\n                    MatrixLog.i(TAG, \"activity with key [%s] should be recycled but actually still exists in %s times, wait for next detection to confirm.\",\n                            destroyedActivityInfo.mKey, destroyedActivityInfo.mDetectedCount);\n\n                    triggerGc();\n                    continue;\n                }\n\n                MatrixLog.i(TAG, \"activity with key [%s] was suspected to be a leaked instance. mode[%s]\", destroyedActivityInfo.mKey, mDumpHprofMode);\n\n                if (mLeakProcessor == null) {\n                    throw new NullPointerException(\"LeakProcessor not found!!!\");\n                }\n\n                if (mLeakProcessor.process(destroyedActivityInfo)) {\n                    MatrixLog.i(TAG, \"the leaked activity [%s] with key [%s] has been processed. stop polling\", destroyedActivityInfo.mActivityName, destroyedActivityInfo.mKey);\n                    infoIt.remove();\n                }\n            }\n\n            return Status.RETRY;\n        }\n    };\n\n    public BaseLeakProcessor getLeakProcessor() {\n        return mLeakProcessor;\n    }\n\n    public ResourcePlugin getResourcePlugin() {\n        return mResourcePlugin;","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-android/src/main/java/com/tencent/matrix/resource/watcher/ActivityRefWatcher.java#L277-L313","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nActivityRefWatcher watcher = new ActivityRefWatcher(...); // no processor\n// after\nwatcher.setLeakProcessor(new DefaultLeakProcessor(new DefaultHeapDump()));","handlingStrategy":"validation","validationCode":"if (watcher.getLeakProcessor() == null) {\n    watcher.setLeakProcessor(new DefaultLeakProcessor(new DefaultHeapDump()));\n}","typeGuard":null,"tryCatchPattern":"try {\n    watcher.start();\n} catch (NullPointerException e) {\n    Log.e(TAG, \"LeakProcessor missing; reconfigure watcher\", e);\n}","preventionTips":["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"],"tags":["memory-leak","configuration","null-pointer","android"],"backgroundTag":"missing-required-config","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}