fix(lua.core): responses are cut off when they do not fit the socket send buffer
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- lua
- Ambito
- networking
Direzione di ricerca
Il bug è in send_raw in src/lua/core/server.lua, che invia la risposta HTTP con un singolo send() non bloccante. Leggi quella funzione e applica la fix settimeout suggerita o gestisci invii parziali. Done significa che le grandi risposte game-state sono consegnate completamente senza chiusura anticipata della connessione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- Python
- Stelle
- 80
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di coder/balatrobot
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
coder/balatrobot#244 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
coder/balatrobot#235 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
coder/balatrobot#234 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
coder/balatrobot#233 ·
-
fix!(lua): G.GAME state survives menu+start — a previous run's won flag marks later losses as winsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
coder/balatrobot#232 ·
Tutte le issue di coder/balatrobot
Issue simili
-
documentation good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
MarketSquare/robotframework-browser#5479 ·
I maintainer di solito rispondono entro 1 giorno
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
endoflife-date/endoflife.date#11561 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
OCA/l10n-brazil#5602 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation review-2.0.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dkuenzel/meshcore-home-gateway#106 ·
I maintainer di solito rispondono entro 1 giorno