Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Application limits.timeout is incorrect on streaming response #1626

Open

Description

Bug Overview

From documentation of limits.timeout,

Integer; request timeout in seconds. If an app process exceeds it while handling a request, Unit cancels the request and returns a 503 "Service Unavailable" response to the client.
https://unit.nginx.org/configuration/#configuration-proc-mgmt-lmts

What I understand from here is this timeout value should be the end-to-end lifetime of a request, not idle time between chunked responses / packets.

However, if I were to say I got a chunked response from server that is:

  1. Send 1st line
  2. Sleep 10sec
  3. Send 2nd line
  4. Sleep 10sec
  5. Send 3rd line, ending request

With a timeout of 15sec on unit configuration, I would expect the request to get cancelled on 15sec mark, and not receiving the 3rd line. Not sure what Unit should do to the http response here though because the header has already been sent and we can't just reverse course and replace it with 503 error.

Expected Behavior

Application timeout should be end-to-end timeout, not idle timeout.

Steps to Reproduce the Bug

The gist is in https://gist.github.com/Holi0317/215f2e0eadecf727fdf74a4efd10bda7. Using nodejs/hono for implementation here but it is affecting other languages as well. I first noticed this issue on PHP/Laravel environment in my work.

git clone https://gist.github.com/215f2e0eadecf727fdf74a4efd10bda7.git
cd 215f2e0eadecf727fdf74a4efd10bda7
docker build -t unittimeout .
docker run --rm -p 8080:80 unittimeout
# In another terminal
curl -v http://127.0.0.1:8080

The request will run for 20sec, with container log output:

Tue Jun 24 2025 15:14:27 GMT+0000 (Coordinated Universal Time) UwU 1
Tue Jun 24 2025 15:14:37 GMT+0000 (Coordinated Universal Time) UwU 2
Tue Jun 24 2025 15:14:47 GMT+0000 (Coordinated Universal Time) UwU 2

Environment Details

  • Target deployment platform: Docker
  • Target OS: Debian 12 in container
  • Version of this project or specific commit: 1.34.2
  • Version of any relevant project languages: node v22.16.0

Additional Context

I guess nxt_router.c is installing timeout handler nxt_router_app_timeout when receiving a new packet, without taking the time elapsed into account. But not really sure because I don't really know C.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /