Tencent/tinker · critical · TinkerRuntimeException
readAndCheckPropertyWithLock fail
Error message
readAndCheckPropertyWithLock fail
What it means
SharePatchInfo.readAndCheckPropertyWithLock takes a file lock on the lock file and then reads/validates /assets-patch info file (info file). Any exception from lock acquisition (ShareFileLockHelper.getFileLock) or from readAndCheckProperty (IO error, JSON/format validation failure) is wrapped in TinkerRuntimeException('readAndCheckPropertyWithLock fail'). The patch metadata is unusable, so loading cannot proceed.
Source
Thrown at tinker-android/tinker-android-loader-no-op/src/main/java/com/tencent/tinker/loader/shareutil/SharePatchInfo.java:78
this.isRemoveInterpretOATDir = isRemoveInterpretOATDir;
}
public static SharePatchInfo readAndCheckPropertyWithLock(File pathInfoFile, File lockFile) {
if (pathInfoFile == null || lockFile == null) {
return null;
}
File lockParentFile = lockFile.getParentFile();
if (!lockParentFile.exists()) {
lockParentFile.mkdirs();
}
SharePatchInfo patchInfo;
ShareFileLockHelper fileLock = null;
try {
fileLock = ShareFileLockHelper.getFileLock(lockFile);
patchInfo = readAndCheckProperty(pathInfoFile);
} catch (Exception e) {
throw new TinkerRuntimeException("readAndCheckPropertyWithLock fail", e);
} finally {
try {
if (fileLock != null) {
fileLock.close();
}
} catch (IOException e) {
ShareTinkerLog.w(TAG, "releaseInfoLock error", e);
}
}
return patchInfo;
}
public static boolean rewritePatchInfoFileWithLock(File pathInfoFile, SharePatchInfo info, File lockFile) {
if (pathInfoFile == null || info == null || lockFile == null) {
return false;
}
File lockParentFile = lockFile.getParentFile();View on GitHub (pinned to 1b7ea02c23)
Solutions
- Clean the patch directory (Tinker.with(context).cleanPatch()) and re-download/re-apply the patch to regenerate the info file.
- Inspect the info file content on device (run-as / adb) to confirm which validation failed (missing or malformed fields).
- Ensure tinker only applies patches from one process and the patch directory is on writable internal storage.
- Upgrade tinker if the failure recurs across patches — old versions had weaker atomic-write behavior for info files.
Example fix
// before
SharePatchInfo info = SharePatchInfo.readAndCheckPropertyWithLock(infoFile, lockFile);
// after
SharePatchInfo info;
try {
info = SharePatchInfo.readAndCheckPropertyWithLock(infoFile, lockFile);
} catch (TinkerRuntimeException e) {
ShareTinkerLog.e(TAG, "patch info unreadable, clean and retry patch later", e);
Tinker.with(context).cleanPatch();
info = null;
} Defensive patterns
Strategy: try-catch
Validate before calling
File info = new File(patchDir, "info");
if (!SharePatchFileUtil.isLegalFile(info)) {
// patch state missing/corrupt -> clean and re-apply later
} Try / catch
catch TinkerRuntimeException with cause 'readAndCheckPropertyWithLock fail' -> Tinker.with(ctx).cleanPatch() and schedule re-download
Prevention
- Let only one process write/read patch info under the tinker lock convention.
- Validate patch package md5 before applying so corrupt info files are never persisted.
- Treat unreadable patch info as 'no patch installed' rather than a crash.
When it happens
Trigger: Corrupted or truncated patch info file (bad JSON, missing keys — readAndCheckProperty validates fields); info file unreadable due to permissions/disk; lock file parent uncreatable (mkdirs failed on read-only storage); concurrent process holding the lock in a bad state.
Common situations: Patch install interrupted midway leaving a half-written info file; device storage corruption or full disk; process killed during upgrade; running tinker in multiple processes without the recommended single-process configuration.
Related errors
- rewritePatchInfoFileWithLock fail
- readAndCheckPropertyWithLock fail
- rewritePatchInfoFileWithLock fail
- Tinker Exception:FileLockHelper lock file failed: {}
- Tinker Exception:FileLockHelper lock file failed: {}
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/bc70aa48104669aa.
Report an issue: GitHub.