fix(lua.core): responses are cut off when they do not fit the socket send buffer
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 85/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- lua
- Lĩnh vực
- networking
Hướng nghiên cứu
Lỗi nằm ở send_raw trong src/lua/core/server.lua, hàm gửi phản hồi HTTP bằng một send() không chặn duy nhất. Đọc hàm đó và áp dụng bản sửa settimeout được gợi ý hoặc xử lý các gửi một phần. Done có nghĩa là các phản hồi game-state lớn được gửi đầy đủ mà không đóng kết nối sớm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
send_raw in src/lua/core/server.lua writes the HTTP response with a single send() on the client socket, which the server put into non-blocking mode (client:settimeout(0)), and then the connection is closed.
LuaSocket's send on a non-blocking socket writes only what fits into the kernel send buffer and returns nil, "timeout", last_byte_sent for the rest. That partial result is not handled, so a large reply (a full game state) is truncated and the client sees the connection close early.
Steps to Reproduce
- Run several BalatroBot instances in parallel on a loaded machine
- Drive normal runs that return large game states (
play,gamestatein the shop). - Occasionally the client gets
http.client.RemoteDisconnected: Remote end closed connection without response
It seems to be load-dependent: the slower the client reads, the more likely the reply does not fit the buffer.
Expected Behavior
The whole response is delivered, however large.
Actual Behavior
The response is cut off at whatever fit into the send buffer; the rest is dropped.
Suggested Fix
Smallest change (what we run, as a patch in our container image; we have not seen a cut-off reply
in about 50 container runs since):
BB_SERVER.client_socket:settimeout(5)
local _, err = BB_SERVER.client_socket:send(response_str)
This blocks the game loop for at most 5 s if the client stops reading. If that is not acceptable, the
alternative is to keep the unsent tail (send(data, last + 1)) and finish it on the next update ticks
before closing the socket.
Environment
- BalatroBot 1.5.2 (and
devat 2026-07-28), Balatro 1.0.1o, Steamodded 1.0.0~BETA-1814a - Linux container (Fedora 42, LÖVE 11.5), Python client with
urllib
Files
src/lua/core/server.lua(send_raw)
- Ngôn ngữ chính
- Python
- Star
- 79
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/balatrobot
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
coder/balatrobot#244 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
coder/balatrobot#235 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
coder/balatrobot#234 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
coder/balatrobot#233 ·
-
fix!(lua): G.GAME state survives menu+start — a previous run's won flag marks later losses as winsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
coder/balatrobot#232 ·
Tất cả issue của coder/balatrobot
Issue tương tự
-
Backend issue lists report in-patch warnings and out-of-patch errors as not publishableCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mozilla/code-review#3794 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Update docs that still describe the security registry as emptyCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] adb backup script reports "Done" & exits 0 when the backup failsCó thể đã có người làm @bhattmanthan đã nhận hôm nay. Đang mởrequest-issue-assignment
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OWASP/mastg#4034 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-ui bug p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
correction metadata
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
acl-org/acl-anthology#10768 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày