[BUG] ERROR [ExpressAdapter] Premature closure #1304

Closed
opened 2026-02-05 01:12:38 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @thyeestes on GitHub (Sep 5, 2023).

The bug

2023-09-05T11:06:23.486987000+02:00 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
2023-09-05T11:06:23.487164000+02:00 at new NodeError (node:internal/errors:405:5)
2023-09-05T11:06:23.487243000+02:00 at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
2023-09-05T11:06:23.487322000+02:00 at ServerResponse.emit (node:events:526:35)
2023-09-05T11:06:23.487403000+02:00 at emitCloseNT (node:_http_server:996:10)
2023-09-05T11:06:23.487492000+02:00 at Socket.onServerResponseClose (node:_http_server:278:5)
2023-09-05T11:06:23.487570000+02:00 at Socket.emit (node:events:526:35)
2023-09-05T11:06:23.487641000+02:00 at TCP. (node:net:323:12)

The OS that Immich Server is running on

WSL2 - Mint - Podman

Version of Immich Server

1.76.1

Version of Immich Mobile App

1.76.0 build.99

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

Not using docker compose, I use quadlet instead

Your .env content

##   Immich server   ##  
  - name: server
    image: ghcr.io/immich-app/immich-server:release
    args:
    - start-server.sh
    env:
    - name: REVERSE_GEOCODING_PRECISION
      value: "3"
    - name: TYPESENSE_API_KEY
      valueFrom:
        secretKeyRef:
          name: immich_typesense_api_key
          key: password 
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: immich_db_password
          key: password 
    - name: DB_HOSTNAME
      value: 127.0.0.1
    - name: DB_DATABASE_NAME
      value: immich
    - name: DB_USERNAME
      value: immich
    - name: IMMICH_WEB_URL
      value: http://127.0.0.1:3000
    - name: IMMICH_MACHINE_LEARNING_URL
      value: http://127.0.0.1:3003 
    - name: IMMICH_SERVER_URL
      value: http://127.0.0.1:3001      
    - name: REDIS_HOSTNAME
      value: 127.0.0.1
    volumeMounts:
    - mountPath: /usr/src/app/upload
      name: home-thyestes-podman-appdata-pod-immich-memories-host-0
##   Immich microservices   ##      
  - name: microservices
    image: ghcr.io/immich-app/immich-server:release
    args:
    - start-microservices.sh
    env:
    - name: REVERSE_GEOCODING_PRECISION
      value: "3"
    - name: TYPESENSE_API_KEY
      valueFrom:
        secretKeyRef:
          name: immich_typesense_api_key
          key: password 
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: immich_db_password
          key: password 
    - name: DB_HOSTNAME
      value: 127.0.0.1
    - name: DB_DATABASE_NAME
      value: immich
    - name: DB_USERNAME
      value: immich
    - name: IMMICH_WEB_URL
      value: http://127.0.0.1:3000
    - name: IMMICH_MACHINE_LEARNING_URL
      value: http://127.0.0.1:3003 
    - name: IMMICH_SERVER_URL
      value: http://127.0.0.1:3001      
    - name: REDIS_HOSTNAME
      value: 127.0.0.1

Reproduction steps

1. Open Immich via a browser
2. Assign a few peoples names in the explore section
3. In Immich server  the above error appears
4. Immich server container needs to be restarted as website hangs

Additional information

After restart I get an internal server error, but after a few refreshes the website is responsive again. Until I repeat the steps above

Originally created by @thyeestes on GitHub (Sep 5, 2023). ### The bug 2023-09-05T11:06:23.486987000+02:00 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close 2023-09-05T11:06:23.487164000+02:00 at new NodeError (node:internal/errors:405:5) 2023-09-05T11:06:23.487243000+02:00 at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30) 2023-09-05T11:06:23.487322000+02:00 at ServerResponse.emit (node:events:526:35) 2023-09-05T11:06:23.487403000+02:00 at emitCloseNT (node:_http_server:996:10) 2023-09-05T11:06:23.487492000+02:00 at Socket.onServerResponseClose (node:_http_server:278:5) 2023-09-05T11:06:23.487570000+02:00 at Socket.emit (node:events:526:35) 2023-09-05T11:06:23.487641000+02:00 at TCP.<anonymous> (node:net:323:12) ### The OS that Immich Server is running on WSL2 - Mint - Podman ### Version of Immich Server 1.76.1 ### Version of Immich Mobile App 1.76.0 build.99 ### Platform with the issue - [X] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML Not using docker compose, I use quadlet instead ``` ### Your .env content ```Shell ## Immich server ## - name: server image: ghcr.io/immich-app/immich-server:release args: - start-server.sh env: - name: REVERSE_GEOCODING_PRECISION value: "3" - name: TYPESENSE_API_KEY valueFrom: secretKeyRef: name: immich_typesense_api_key key: password - name: DB_PASSWORD valueFrom: secretKeyRef: name: immich_db_password key: password - name: DB_HOSTNAME value: 127.0.0.1 - name: DB_DATABASE_NAME value: immich - name: DB_USERNAME value: immich - name: IMMICH_WEB_URL value: http://127.0.0.1:3000 - name: IMMICH_MACHINE_LEARNING_URL value: http://127.0.0.1:3003 - name: IMMICH_SERVER_URL value: http://127.0.0.1:3001 - name: REDIS_HOSTNAME value: 127.0.0.1 volumeMounts: - mountPath: /usr/src/app/upload name: home-thyestes-podman-appdata-pod-immich-memories-host-0 ## Immich microservices ## - name: microservices image: ghcr.io/immich-app/immich-server:release args: - start-microservices.sh env: - name: REVERSE_GEOCODING_PRECISION value: "3" - name: TYPESENSE_API_KEY valueFrom: secretKeyRef: name: immich_typesense_api_key key: password - name: DB_PASSWORD valueFrom: secretKeyRef: name: immich_db_password key: password - name: DB_HOSTNAME value: 127.0.0.1 - name: DB_DATABASE_NAME value: immich - name: DB_USERNAME value: immich - name: IMMICH_WEB_URL value: http://127.0.0.1:3000 - name: IMMICH_MACHINE_LEARNING_URL value: http://127.0.0.1:3003 - name: IMMICH_SERVER_URL value: http://127.0.0.1:3001 - name: REDIS_HOSTNAME value: 127.0.0.1 ``` ### Reproduction steps ```bash 1. Open Immich via a browser 2. Assign a few peoples names in the explore section 3. In Immich server the above error appears 4. Immich server container needs to be restarted as website hangs ``` ### Additional information After restart I get an internal server error, but after a few refreshes the website is responsive again. Until I repeat the steps above
Author
Owner

@Cebrain commented on GitHub (Sep 23, 2023):

I have the same problem. Sometimes the webpage get stuck and i need to refresh the webpage.
Using the Docker-Compose file and Traefik Proxy infront of the server.

Server was freshly installed yesterday and i am using external path at the moment.

@Cebrain commented on GitHub (Sep 23, 2023): I have the same problem. Sometimes the webpage get stuck and i need to refresh the webpage. Using the Docker-Compose file and Traefik Proxy infront of the server. Server was freshly installed yesterday and i am using external path at the moment.
Author
Owner

@Cebrain commented on GitHub (Sep 23, 2023):

As it looks like the problem is the loading of thumbnails. Is it possible that it tries to load all thumbnails of the page instead step by step?

image

Edit:
I think the problem with the thumbnail loading is related with the reverse proxy, without it it runs much better

@Cebrain commented on GitHub (Sep 23, 2023): As it looks like the problem is the loading of thumbnails. Is it possible that it tries to load all thumbnails of the page instead step by step? ![image](https://github.com/immich-app/immich/assets/78339531/b37e66a8-bb28-4f84-9c97-137acc515b62) Edit: I think the problem with the thumbnail loading is related with the reverse proxy, without it it runs much better
Author
Owner

@C8opmBM commented on GitHub (Oct 3, 2023):

I have the same behaviour, using latest 1.80 version (docker compose)
Using caddy as reverse proxy.

Functionality doesn't seem to be affected, only log spammed.

Clipboard01

@C8opmBM commented on GitHub (Oct 3, 2023): I have the same behaviour, using latest 1.80 version (docker compose) Using caddy as reverse proxy. Functionality doesn't seem to be affected, only log spammed. ![Clipboard01](https://github.com/immich-app/immich/assets/60513190/2de50533-c989-4a0e-8a11-4c24b3067a8c)
Author
Owner

@Cebrain commented on GitHub (Oct 3, 2023):

Î think when we visit the Immich Page / Timeline / People.
It sometimes trys to load all pictures at once. So the rate limit in a reverse proxy kicks in.
After disabling the rate limit in my reverse proxy it did work fine.

I created a issue for that, maybe it is the same problem in the end.
https://github.com/immich-app/immich/issues/4194

@Cebrain commented on GitHub (Oct 3, 2023): Î think when we visit the Immich Page / Timeline / People. It sometimes trys to load all pictures at once. So the rate limit in a reverse proxy kicks in. After disabling the rate limit in my reverse proxy it did work fine. I created a issue for that, maybe it is the same problem in the end. https://github.com/immich-app/immich/issues/4194
Author
Owner

@atlas-shrugged08 commented on GitHub (Nov 5, 2023):

I am using the default reverse proxy and see the same spamming in my logs. (using default docker compose, no modifications)

023-11-05 04:17:29 [Nest] 6  - 11/05/2023, 10:17:29 AM   ERROR [ExpressAdapter] Premature close
2023-11-05 04:17:29 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
2023-11-05 04:17:29     at new NodeError (node:internal/errors:406:5)
2023-11-05 04:17:29     at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
2023-11-05 04:17:29     at ServerResponse.emit (node:events:526:35)
2023-11-05 04:17:29     at emitCloseNT (node:_http_server:1023:10)
2023-11-05 04:17:29     at Socket.onServerResponseClose (node:_http_server:278:5)
2023-11-05 04:17:29     at Socket.emit (node:events:526:35)
2023-11-05 04:17:29     at TCP.<anonymous> (node:net:337:12)
2023-11-05 04:17:29 [Nest] 6  - 11/05/2023, 10:17:29 AM   ERROR [ExpressAdapter] Premature close
2023-11-05 04:17:29 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
2023-11-05 04:17:29     at new NodeError (node:internal/errors:406:5)
2023-11-05 04:17:29     at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
2023-11-05 04:17:29     at ServerResponse.emit (node:events:526:35)
2023-11-05 04:17:29     at emitCloseNT (node:_http_server:1023:10)
2023-11-05 04:17:29     at Socket.onServerResponseClose (node:_http_server:278:5)
2023-11-05 04:17:29     at Socket.emit (node:events:526:35)
2023-11-05 04:17:29     at TCP.<anonymous> (node:net:337:12)
@atlas-shrugged08 commented on GitHub (Nov 5, 2023): I am using the default reverse proxy and see the same spamming in my logs. (using default docker compose, no modifications) ``` 023-11-05 04:17:29 [Nest] 6 - 11/05/2023, 10:17:29 AM ERROR [ExpressAdapter] Premature close 2023-11-05 04:17:29 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close 2023-11-05 04:17:29 at new NodeError (node:internal/errors:406:5) 2023-11-05 04:17:29 at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30) 2023-11-05 04:17:29 at ServerResponse.emit (node:events:526:35) 2023-11-05 04:17:29 at emitCloseNT (node:_http_server:1023:10) 2023-11-05 04:17:29 at Socket.onServerResponseClose (node:_http_server:278:5) 2023-11-05 04:17:29 at Socket.emit (node:events:526:35) 2023-11-05 04:17:29 at TCP.<anonymous> (node:net:337:12) 2023-11-05 04:17:29 [Nest] 6 - 11/05/2023, 10:17:29 AM ERROR [ExpressAdapter] Premature close 2023-11-05 04:17:29 Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close 2023-11-05 04:17:29 at new NodeError (node:internal/errors:406:5) 2023-11-05 04:17:29 at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30) 2023-11-05 04:17:29 at ServerResponse.emit (node:events:526:35) 2023-11-05 04:17:29 at emitCloseNT (node:_http_server:1023:10) 2023-11-05 04:17:29 at Socket.onServerResponseClose (node:_http_server:278:5) 2023-11-05 04:17:29 at Socket.emit (node:events:526:35) 2023-11-05 04:17:29 at TCP.<anonymous> (node:net:337:12) ```
Author
Owner

@Shamino-UO commented on GitHub (Nov 14, 2023):

Same error here, Windows 11 PRO > WSL2 > Ubuntu 23.04 > Default docker compose

immich_server | [Nest] 7 - 11/13/2023, 11:32:17 PM ERROR [ExpressAdapter] Premature close
immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
immich_server | at new NodeError (node:internal/errors:406:5)
immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
immich_server | at ServerResponse.emit (node:events:526:35)
immich_server | at emitCloseNT (node:_http_server:1023:10)
immich_server | at Socket.onServerResponseClose (node:_http_server:278:5)
immich_server | at Socket.emit (node:events:526:35)
immich_server | at TCP. (node:net:337:12)

@Shamino-UO commented on GitHub (Nov 14, 2023): Same error here, Windows 11 PRO > WSL2 > Ubuntu 23.04 > Default docker compose > immich_server | [Nest] 7 - 11/13/2023, 11:32:17 PM ERROR [ExpressAdapter] Premature close immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close immich_server | at new NodeError (node:internal/errors:406:5) immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30) immich_server | at ServerResponse.emit (node:events:526:35) immich_server | at emitCloseNT (node:_http_server:1023:10) immich_server | at Socket.onServerResponseClose (node:_http_server:278:5) immich_server | at Socket.emit (node:events:526:35) immich_server | at TCP.<anonymous> (node:net:337:12)
Author
Owner

@lslvxy commented on GitHub (Nov 17, 2023):

Same error here, Windows 11 PRO > WSL2 > Ubuntu 23.04 > Default docker compose

immich_server | [Nest] 7 - 11/13/2023, 11:32:17 PM ERROR [ExpressAdapter] Premature close
immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
immich_server | at new NodeError (node:internal/errors:406:5)
immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
immich_server | at ServerResponse.emit (node:events:526:35)
immich_server | at emitCloseNT (node:_http_server:1023:10)
immich_server | at Socket.onServerResponseClose (node:_http_server:278:5)
immich_server | at Socket.emit (node:events:526:35)
immich_server | at TCP. (node:net:337:12)

Same error i used a public ip port forward to my local openwrt ip ,then port forward to immich server .
It happend when i use public ip to visit ,local ip is ok

@lslvxy commented on GitHub (Nov 17, 2023): > Same error here, Windows 11 PRO > WSL2 > Ubuntu 23.04 > Default docker compose > > > immich_server | [Nest] 7 - 11/13/2023, 11:32:17 PM ERROR [ExpressAdapter] Premature close > > immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close > > immich_server | at new NodeError (node:internal/errors:406:5) > > immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30) > > immich_server | at ServerResponse.emit (node:events:526:35) > > immich_server | at emitCloseNT (node:_http_server:1023:10) > > immich_server | at Socket.onServerResponseClose (node:_http_server:278:5) > > immich_server | at Socket.emit (node:events:526:35) > > immich_server | at TCP. (node:net:337:12) Same error i used a public ip port forward to my local openwrt ip ,then port forward to immich server . It happend when i use public ip to visit ,local ip is ok
Author
Owner

@mertalev commented on GitHub (Dec 24, 2023):

This error no longer occurs in the latest version.

@mertalev commented on GitHub (Dec 24, 2023): This error no longer occurs in the latest version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1304