Open kamzil opened 4 months ago
In immich-server container log when the Brave error happens:
[31m ERROR[39m [38;5;3m[StreamableFile] [39m[31mPremature close[39m
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
at ServerResponse.emit (node:events:530:35)
at emitCloseNT (node:_http_server:1031:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:530:35)
at TCP.<anonymous> (node:net:337:12)
I'm getting the same error when downloading a 4GB album. The problem only occur in Edge on windows. Re-attempting the download in Firefox worked.
[Nest] 7 - 05/27/2024, 11:14:38 PM ERROR [ImmichServer] [StreamableFile] Premature close
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
at /usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:55
at AsyncLocalStorage.run (node:async_hooks:346:14)
at AsyncLocalStorageContextManager.with (/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
at ServerResponse.contextWrapper (/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:32)
at ServerResponse.emit (node:events:531:35)
at emitCloseNT (node:_http_server:1020:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:531:35)
at TCP.<anonymous> (node:net:338:12)
I'm getting the same error when downloading a 1GB video. I tried both iOS app and browser. The version of iOS app is 1.108.0 build.163, and the error log follows:
The bug
When I try to download an album from the webapp on either Firefox or Brave browser on Android, the app first displays a progress bar that says "Downloading".
I think how this works is it's actually streaming the zip into the browser's memory, and only after it's finished, it will start "downloading" the file to the storage, rather than behaving like a normal browser file download where file is streamed to the device's storage from the start. Maybe the device's RAM gets too full and Firefox gets killed. This doesn't appear to be a very scalable way of downloading large files, as mobile apps are often very restricted on RAM usage.
Looking at the source code, it seems to stream the data from the server into a client-side blob and only then opening it as a link to initiate the browser download functionality to save it to the storage.
The OS that Immich Server is running on
Docker
Version of Immich Server
v1.96.0
Version of Immich Mobile App
Web
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
Additional information
No response