Skip to content

luci-app-dockerman: supports multiplexed stream format logs - #8976

Open
jjm2473 wants to merge 1 commit into
openwrt:masterfrom
jjm2473:pr-master/dockermanjs-rework-mstream-logs
Open

luci-app-dockerman: supports multiplexed stream format logs#8976
jjm2473 wants to merge 1 commit into
openwrt:masterfrom
jjm2473:pr-master/dockermanjs-rework-mstream-logs

Conversation

@jjm2473

@jjm2473 jjm2473 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

https://docs.docker.com/reference/api/engine/version/v1.43/#stream-format

Pull request details

Description

docker.container logs does not work with "application/vnd.docker.multiplexed-stream" response.

  1. Create a container without pseudo-TTY (-t) docker run --name testlog alpine ls -la
  2. Run ubus call docker.container logs '{"id":"testlog","query":{"stdout":true,"stderr":true,"tail":100}}'

Before this patch:

{
        "code": 200,
        "headers": {
                "api-version": "1.47",
                "content-type": "application/vnd.docker.multiplexed-stream",
                "docker-experimental": "false",
                "ostype": "linux",
                "server": "Docker/27.3.1 (linux)",
                "date": "Mon, 24 Aug 2026 13:15:12 GMT",
                "connection": "close",
                "transfer-encoding": "chunked"
        },
        "body": "\u0001"
}

After patch:

{
        "code": 200,
        "headers": {
                "api-version": "1.47",
                "content-type": "application/vnd.docker.multiplexed-stream",
                "docker-experimental": "false",
                "ostype": "linux",
                "server": "Docker/27.3.1 (linux)",
                "date": "Mon, 24 Aug 2026 13:16:07 GMT",
                "connection": "close",
                "transfer-encoding": "chunked"
        },
        "body": [
                {
                        "type": 1,
                        "payload": "total 64\n"
                },
                {
                        "type": 1,
                        "payload": "drwxr-xr-x    1 root     root          4096 Aug 24 12:29 .\n"
                },
                {
                        "type": 1,
                        "payload": "drwxr-xr-x    1 root     root          4096 Aug 24 12:29 ..\n"
                },
                {
                        "type": 1,
                        "payload": "-rwxr-xr-x    1 root     root             0 Aug 24 12:29 .dockerenv\n"
                },
                {
                        "type": 1,
                        "payload": "drwxr-xr-x    2 root     root          4096 Oct  8  2025 bin\n"
                },
               ...
        ]
}

Screenshot or video of changes (if applicable)

Before:
image

After:
image

Maintainer (preferred)

@systemcrash


Tested on

OpenWrt version: OpenWrt 25.12.5
LuCI version: LuCI openwrt-25.12 branch
Web browser(s): Chrome 151.0.7922.76

(Both JS API and RPC were tested)


Checklist

  • (Nice to have) Includes what Issue it closes (e.g. openwrt/luci#issue-number).
  • (Nice to have) Includes what it depends on (e.g. openwrt/packages#pr-number in sister repo).

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; see inline comments. The ucode-side parser matches the byte semantics of ord()/substr() correctly; the JS-side parser in api.js operates on a UTF-8-decoded string and does not.


Generated by Claude Code

Comment thread applications/luci-app-dockerman/htdocs/luci-static/resources/dockerman/api.js Outdated
@jjm2473
jjm2473 force-pushed the pr-master/dockermanjs-rework-mstream-logs branch from c90e845 to 93ba06d Compare August 25, 2026 05:24

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit (force-push of 93ba06d, diffed against c90e845). All three findings from the previous round are addressed: parse_multiplexed_stream now operates on a Uint8Array from response.arrayBuffer() with a TextDecoder per payload, so byte offsets and frame boundaries are correct for payloads ≥ 128 bytes and for multi-byte UTF-8; the >>> 0 on the length field is right; and the No logs available fallback is restored after the frame join. Two remaining inline notes, one of them a nit.


Generated by Claude Code

Comment thread applications/luci-app-dockerman/htdocs/luci-static/resources/dockerman/api.js Outdated
@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Aug 26, 2026
@jjm2473
jjm2473 marked this pull request as draft August 26, 2026 03:44
@jjm2473
jjm2473 force-pushed the pr-master/dockermanjs-rework-mstream-logs branch from 1094402 to a315188 Compare August 26, 2026 03:54
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Aug 26, 2026
@jjm2473
jjm2473 marked this pull request as ready for review August 26, 2026 03:58

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit (force-push of a315188, diffed against 93ba06d). Both notes from the previous round are addressed: the ?.['content-type'] optional chain no longer throws when the rpcd path resolves with a bare ubus status number, and the frame walk now advances with subarray() views instead of copying slice(), removing the quadratic re-copy. Commit message matches the change; CI on the head SHA is green or still running. One low-severity inline note left.


Generated by Claude Code

Comment thread applications/luci-app-dockerman/htdocs/luci-static/resources/dockerman/api.js Outdated
@jjm2473
jjm2473 force-pushed the pr-master/dockermanjs-rework-mstream-logs branch from a315188 to c13ebfe Compare August 26, 2026 05:12

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit (force-push of c13ebfe, diffed against a315188). The remaining note from the previous round is addressed, and in the more accurate of the two forms offered: per-stream-type TextDecoders with { stream: true }, so a UTF-8 sequence split across frames is reassembled without mixing state between stdout and stderr. Commit message still matches the change, and all eight checks on the head SHA are green.

Two nits left, both in parse_multiplexed_stream.


Generated by Claude Code

Comment thread applications/luci-app-dockerman/htdocs/luci-static/resources/dockerman/api.js Outdated
@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Aug 26, 2026
https://docs.docker.com/reference/api/engine/version/v1.43/#stream-format

Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de>
Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
@jjm2473
jjm2473 force-pushed the pr-master/dockermanjs-rework-mstream-logs branch from af49bac to 45109fc Compare August 26, 2026 18:37
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Aug 26, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit (force-push of 45109fc, diffed against c13ebfe); no new issues found.

The delta is exactly the two nits from the previous round: the dead stream_type >= 0 half of the range test is gone, and { stream: true } now carries the inner padding used elsewhere in the file. The arrow-function reformat in container.js:1690 is cosmetic and matches the surrounding style. Commit message still matches the change, and all eight checks on the head SHA are green.

Also noting your reply on the trailing-flush thread — with the whole body read in one shot and a fresh set of decoders per call, the remnant only matters for a stream whose final frame ends mid-sequence, which Docker's json-file driver won't produce. Happy to leave it.


Generated by Claude Code

@jjm2473

jjm2473 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

ping @systemcrash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants