CarGuo/GSYVideoPlayer · warning · ProxyCacheException
Error writing %d bytes to %s from buffer with size %d
Error message
Error writing %d bytes to %s from buffer with size %d
What it means
FileCache.close closes the RandomAccessFile and touches DiskUsage (updates last-modified for LRU). IOException from dataFile.close() is wrapped as 'Error closing file <path>'. Note close() is also called inside complete(), so this error can surface during completion as well as during release.
Source
Thrown at gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/file/FileCache.java:73
dataFile.seek(offset);
return dataFile.read(buffer, 0, length);
} catch (IOException e) {
String format = "Error reading %d bytes with offset %d from file[%d bytes] to buffer[%d bytes]";
throw new ProxyCacheException(String.format(format, length, offset, available(), buffer.length), e);
}
}
@Override
public synchronized void append(byte[] data, int length) throws ProxyCacheException {
try {
if (isCompleted()) {
throw new ProxyCacheException("Error append cache: cache file " + file + " is completed!");
}
dataFile.seek(available());
dataFile.write(data, 0, length);
} catch (IOException e) {
String format = "Error writing %d bytes to %s from buffer with size %d";
throw new ProxyCacheException(String.format(format, length, dataFile, data.length), e);
}
}
@Override
public synchronized void close() throws ProxyCacheException {
try {
dataFile.close();
diskUsage.touch(file);
} catch (IOException e) {
throw new ProxyCacheException("Error closing file " + file, e);
}
}
@Override
public synchronized void complete() throws ProxyCacheException {
if (isCompleted()) {
return;
}View on GitHub (pinned to e5d74d3aa9)
Solutions
- Keep cache files on internal storage not visible to cleaner apps
- Treat close-time errors during release()/shutdown() as log-only - the session is ending anyway
- Ensure eviction does not delete the file whose FileCache is still open (one proxy instance per dir)
- If seen during complete(), check disk health / remount state of the storage holding the cache
Example fix
// before
public void release() { fileCache.close(); }
// after - tolerate close failure during teardown
public void release() {
try { fileCache.close(); }
catch (ProxyCacheException e) { Log.w(TAG, "cache close failed during release", e); }
} Defensive patterns
Strategy: try-catch
Try / catch
try { fileCache.close(); }
catch (ProxyCacheException e) {
if (String.valueOf(e.getMessage()).contains("Error closing file")) {
Log.w(TAG, "close failed during teardown", e); // swallow during release
} else throw e;
} Prevention
- Tolerate close failures during release/shutdown
- Keep cache on internal storage not touched by cleaners
- Investigate only if it fires outside teardown paths
When it happens
Trigger: Closing a RandomAccessFile whose fd is already invalid (file deleted by a cleaner/eviction underneath), or an IO error reported by the OS on close (NFS-ish storage, corrupted sdcard fs).
Common situations: Same family as errors 10/13: file removed mid-session, removable storage ejected, aggressive cache cleaners. Mostly seen as cleanup noise during player release rather than a functional failure.
Related errors
- Error reading source ${errorsCount} times
- Error using file ${file} as disc cache
- Error append cache: cache file %s is completed!
- Error renaming file %s to %s for completion!
- Reading source ${sourceInfo.url} is interrupted
AI-assisted analysis of CarGuo/GSYVideoPlayer@e5d74d3aa9 (2026-08-14).
Data as JSON: /api/errors/0fdf07154ce45a51.
Report an issue: GitHub.