lmLog: "Server error occured" when log contains non-ASCII chars (offset counted in chars, seek in bytes)
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, python
调研方向
Start in lmn_common/views.py at handle_api_log, which seeks by offset, and in lmn_common/resources/js/directives/lmlog.coffee, which sends offset=$scope.content.length. Decide on byte offsets end-to-end (binary read plus a response header the CoffeeScript client uses for the next offset) or the fallback errors='replace'. Reproduce with the two-line Python snippet from the issue, then verify the log view polls past an umlaut-heavy file without a 500.
由索引模型根据 Issue 内容生成。
描述
Description
While users are applied in List Management, the live log view polls
GET /api/lmn/log/tmp/sophomorix.log?offset=<n> every second. Sporadically
the WebUI shows "Server error occured. This is likely a bug." for this request.
The sophomorix run itself completes; only the log view breaks.
Cause
Frontend and backend use different units for offset:
lmn_common/resources/js/directives/lmlog.coffeesends
offset=#{$scope.content.length}, which is the length in characters (JS string).lmn_common/views.py→handle_api_logopens the file in text mode and calls
f.seek(offset), which positions by bytes.
Each non-ASCII character (ä, ö, ü, ß in user names, ...) is 1 char but 2 bytes in
UTF-8, so the offset drifts by one byte per umlaut. When it lands inside a
multibyte sequence, f.read() raises UnicodeDecodeError and the endpoint returns 500.
Minimal reproduction:
open('t.log','w').write('Benutzer Müller angelegt\n')
f = open('t.log'); f.seek(11); f.read()
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 0
With multi-school setups the log easily grows to >1 MB with many umlauts
(we saw offset=1682314), so the error shows up on almost every run.
Environment
linuxmuster-webui7 7.3.40; code is unchanged on master / 7.3.46.
Possible fix
Use byte offsets consistently, e.g. read the file in binary mode and let the
frontend track the received byte length (e.g. via a response header), or at least
open(path, errors='replace') so a misaligned offset no longer causes a 500.
- 主要语言
- HTML
- 星标
- 14
- 派生
- 9
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
linuxmuster/linuxmuster-webui7 的其他 Issue
-
Lack of sorting the rooms in the roomlist of the device-manager of webui可能重新可做 @hermanntoast 于 685 天前认领,目前没有进行中的 PR。 未关闭
linuxmuster/linuxmuster-webui7#278 · 1 条评论 · 已指派 1 人 ·
-
难度 5/5 一周以上 新手友好度 25/100
-
Password print: custom latex templates are not selectable可能重新可做 @kiarn 于 1471 天前认领,目前没有进行中的 PR。 未关闭Needs more details
linuxmuster/linuxmuster-webui7#248 · 4 条评论 · 已指派 1 人 ·
-
import errors not properly catched可能重新可做 @kiarn 于 1502 天前认领,目前没有进行中的 PR。 未关闭Needs more details
linuxmuster/linuxmuster-webui7#244 · 4 条评论 · 已指派 1 人 ·
-
Option: Benutzerdefinierte Felder auf Eindeutigkeit prüfen可能重新可做 @kiarn 于 1502 天前认领,目前没有进行中的 PR。 未关闭Sophomorix issue
linuxmuster/linuxmuster-webui7#240 · 5 条评论 · 已指派 1 人 ·
查看 linuxmuster/linuxmuster-webui7 的全部 Issue
相似的 Issue
-
Performance: deprecated DeviceEntry.config_entries access blocks the event loop for tens of seconds未关闭
难度 2/5 1-3 小时 新手友好度 75/100
tuya/tuya_cloud_ha_bridge#14 ·
-
duplication
难度 2/5 1-3 小时 新手友好度 78/100
openvibely/openvibely#1443 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
semantica-agi/semantica#1967 ·
维护者通常 1 天内回复
-
agent: ready area: evaluation priority: normal type: bug
难度 2/5 1-3 小时 新手友好度 62/100
dkritarth/scopewatch#193 ·
维护者通常 1 天内回复
-
virtio-fs (Linux passthrough): debug log in do_lookup panics the fs worker on non-UTF-8 file names可能已有人在做 @zcl-g5 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 2 天内回复