{"record":{"id":"28ac17490003899a","repo":"CarGuo/GSYVideoPlayer","slug":"error-opening-connection-for-sourceinfo-url-wit","errorCode":null,"errorMessage":"Error opening connection for ${sourceInfo.url} with offset ${offset}","messagePattern":"Error opening connection for (.+?) with offset (.+?)","errorType":"exception","errorClass":"ProxyCacheException","httpStatus":null,"severity":"warning","filePath":"gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/HttpUrlSource.java","lineNumber":96,"sourceCode":"    @Override\n    public synchronized long length() throws ProxyCacheException {\n        if (sourceInfo.length == Integer.MIN_VALUE) {\n            fetchContentInfo();\n        }\n        return sourceInfo.length;\n    }\n\n    @Override\n    public void open(long offset) throws ProxyCacheException {\n        try {\n            connection = openConnection(offset, -1);\n            String mime = connection.getContentType();\n            inputStream = new BufferedInputStream(connection.getInputStream(), DEFAULT_BUFFER_SIZE);\n            long length = readSourceAvailableBytes(connection, offset, connection.getResponseCode());\n            this.sourceInfo = new SourceInfo(sourceInfo.url, length, mime);\n            this.sourceInfoStorage.put(sourceInfo.url, sourceInfo);\n        } catch (IOException e) {\n            throw new ProxyCacheException(\"Error opening connection for \" + sourceInfo.url + \" with offset \" + offset, e);\n        }\n    }\n\n    private long readSourceAvailableBytes(HttpURLConnection connection, long offset, int responseCode) throws IOException {\n        long contentLength = getContentLength(connection);\n        return responseCode == HTTP_OK ? contentLength\n            : responseCode == HTTP_PARTIAL ? contentLength + offset : sourceInfo.length;\n    }\n\n    private long getContentLength(HttpURLConnection connection) {\n        String contentLengthValue = connection.getHeaderField(\"Content-Length\");\n        return contentLengthValue == null ? -1 : Long.parseLong(contentLengthValue);\n    }\n\n    @Override\n    public void close() throws ProxyCacheException {\n        if (connection != null) {\n            try {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/CarGuo/GSYVideoPlayer/blob/e5d74d3aa9d7fb1393a879e33ee380f8f41354f1/gsyVideoPlayer-proxy_cache/src/main/java/com/danikula/videocache/HttpUrlSource.java#L78-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Treat InterruptedProxyCacheException as expected during release - catch and log at debug level, do not report to crash reporting","Raise read timeout if it fires during normal playback (custom source or network config)","Only surface it as an error to the user if the player was NOT being released when it occurred"],"exampleFix":"// before\ncatch (ProxyCacheException e) { Crashlytics.logException(e); }\n\n// after\ncatch (InterruptedProxyCacheException e) {\n    Log.d(TAG, \"Proxy read interrupted (expected during release)\");\n} catch (ProxyCacheException e) {\n    Crashlytics.logException(e);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (InterruptedProxyCacheException e) {\n    // expected on release()/shutdown: log at debug, never crash-report\n    Log.d(TAG, \"proxy read interrupted during shutdown\");\n}","preventionTips":["Do not report InterruptedProxyCacheException to crash analytics","Distinguish it from ProxyCacheException before deciding to retry","Tune read timeouts for slow origins to avoid mid-playback interruption"],"tags":["network","interruption","shutdown","timeout","proxy-cache"],"backgroundTag":null,"analyzedSha":"e5d74d3aa9d7fb1393a879e33ee380f8f41354f1","analyzedAt":"2026-08-14T11:56:11.997Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}