fix(lua.core): responses are cut off when they do not fit the socket send buffer
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- lua
- 領域
- networking
調査の方向性
バグは src/lua/core/server.lua 内の send_raw にあり、単一の非ブロッキングな send() で HTTP レスポンスを送信している。その関数を読み、提案された settimeout 修正を適用するか、部分的な送信を処理せよ。Done は、大きな game-state 応答が早期の接続クローズなしに完全に配信されることを意味する。
索引モデルが issue の本文から書いたものです。
説明
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)
- 主要言語
- Python
- スター
- 79
- フォーク
- 23
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/balatrobot のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
coder/balatrobot#244 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
coder/balatrobot#235 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
coder/balatrobot#234 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
coder/balatrobot#233 ·
-
fix!(lua): G.GAME state survives menu+start — a previous run's won flag marks later losses as winsオープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
coder/balatrobot#232 ·
coder/balatrobot の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/sagemaker-python-sdk#6554 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
huggingface/diffusers#15170 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] LLM conflict check ignores MNEMOSYNE_LLM_MAX_TOKENS, so reasoning models return empty repliesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
mnemosyne-oss/mnemosyne#1325 ·
メンテナーはふだん 1 日以内に返信
-
enhancement meshtastic-2.8
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
pskillen/meshflow-api#459 ·