CarGuo/GSYVideoPlayer · warning · ProxyCacheException

Error opening connection for ${sourceInfo.url} with offset $

Error message

Error opening connection for ${sourceInfo.url} with offset ${offset}

What it means

HttpUrlSource.read wraps inputStream.read; if the read throws InterruptedIOException (e.g. SocketTimeoutException or the source-reader thread being interrupted during shutdown), it is converted to InterruptedProxyCacheException so the ProxyCache machinery can distinguish an intentional stop (player released, thread interrupted) from a real IO failure. 'Reading source ... is interrupted' therefore usually signals shutdown or timeout, not corruption.

Source

Thrown at gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/HttpUrlSource.java:96

    @Override
    public synchronized long length() throws ProxyCacheException {
        if (sourceInfo.length == Integer.MIN_VALUE) {
            fetchContentInfo();
        }
        return sourceInfo.length;
    }

    @Override
    public void open(long offset) throws ProxyCacheException {
        try {
            connection = openConnection(offset, -1);
            String mime = connection.getContentType();
            inputStream = new BufferedInputStream(connection.getInputStream(), DEFAULT_BUFFER_SIZE);
            long length = readSourceAvailableBytes(connection, offset, connection.getResponseCode());
            this.sourceInfo = new SourceInfo(sourceInfo.url, length, mime);
            this.sourceInfoStorage.put(sourceInfo.url, sourceInfo);
        } catch (IOException e) {
            throw new ProxyCacheException("Error opening connection for " + sourceInfo.url + " with offset " + offset, e);
        }
    }

    private long readSourceAvailableBytes(HttpURLConnection connection, long offset, int responseCode) throws IOException {
        long contentLength = getContentLength(connection);
        return responseCode == HTTP_OK ? contentLength
            : responseCode == HTTP_PARTIAL ? contentLength + offset : sourceInfo.length;
    }

    private long getContentLength(HttpURLConnection connection) {
        String contentLengthValue = connection.getHeaderField("Content-Length");
        return contentLengthValue == null ? -1 : Long.parseLong(contentLengthValue);
    }

    @Override
    public void close() throws ProxyCacheException {
        if (connection != null) {
            try {

View on GitHub (pinned to e5d74d3aa9)

Solutions

  1. Treat InterruptedProxyCacheException as expected during release - catch and log at debug level, do not report to crash reporting
  2. Raise read timeout if it fires during normal playback (custom source or network config)
  3. Only surface it as an error to the user if the player was NOT being released when it occurred

Example fix

// before
catch (ProxyCacheException e) { Crashlytics.logException(e); }

// after
catch (InterruptedProxyCacheException e) {
    Log.d(TAG, "Proxy read interrupted (expected during release)");
} catch (ProxyCacheException e) {
    Crashlytics.logException(e);
}
Defensive patterns

Strategy: try-catch

Try / catch

catch (InterruptedProxyCacheException e) {
    // expected on release()/shutdown: log at debug, never crash-report
    Log.d(TAG, "proxy read interrupted during shutdown");
}

Prevention

When it happens

Trigger: The user leaves the page / releases the player and ProxyCache.shutdown() interrupts sourceReaderThread mid-read; or a read timeout fires (InterruptedIOException subclass SocketTimeoutException) while streaming a slow origin.

Common situations: Normal teardown noise when stopping playback mid-buffer; slow mobile networks where the 30s (or configured) read timeout trips; process backgrounded and connections killed by the OS - all surface as this exception in logs.

Related errors


AI-assisted analysis of CarGuo/GSYVideoPlayer@e5d74d3aa9 (2026-08-14). Data as JSON: /api/errors/28ac17490003899a. Report an issue: GitHub.