Repository navigation
Fixes the memory leak in the double dummy solver that 0.9.0.4 brought
(#206), and makes gameapi stricter about the requests it accepts and easier
to run behind a reverse proxy.
Memory leak in bridge-solver fixed (#206)
- A long-running
gameapino longer grows with every deal. In 0.9.0.4
bridge-solver kept each thread's search caches for good: a thread that
exited leaked them, andFreeMemory()did not reach them.gameapigrew
by about 0.25 GB per deal until it ran out of memory. - Now a thread's caches are freed when the thread exits, and
FreeMemory()
frees the caches of every thread. The libraries are built from
bridge-solverdad3495
(BSalita/bridge-solver#1),
and they search exactly as fast as before. - Measured with
gameapiin Docker (Linux x64), playing deals card by card
through/leadand/play: with 0.9.0.4's library memory went from
2.4 GB to 13.3 GB in 24 deals. With the new one it levels off at about
3.3 GB and stays there (46 deals). On macOS (M1) the memory the library
holds stays at 1.6 MB however many threads come and go; before it grew
about 56 MB for every 8 threads. - Replaced for Windows x64, Linux x64, Linux arm64 and macOS arm64, both
BEN's own copy (bin/bsolver) and theddslibrary that PIMC uses
(bin/BGA,bin/dds.dll,bin/libdds.so,bin/darwin).
gameapi
From Bob Salita (#203):
- Malformed requests are refused with 400 and an error text, instead of
being answered with a guess: a hand or dummy that is not 13 different
cards, a missing hand, seat, dealer or dummy,/playasked of dummy's
seat, the wrong seat on/lead, or an unknownvul. A 12-card hand on
/leadused to stop the whole server. /bidreturnsalertas a JSON boolean (true/false). It was the
text"True"/"False", and"False"counts as true in JavaScript.
Clients that compared it with the text must be changed./playfor a passed-out board with nothing played answersboardOver,
as it does when all 52 cards have been played.GET /reports the engine, the version and, in a Docker image, the build.
Behind a reverse proxy
From Bob Salita (#204):
- The web pages and the API pages work when BEN is served through a reverse
proxy or tunnel (the game servers at/ws/<port>/, the API at
/gameapi/<port>/). Opened directly they work as before. gameapi --trusted-proxiesnames the proxies whoseX-Forwarded-For
andCF-Connecting-IPheaders are believed. By default these headers are
now ignored: anyone could send them and get round the rate limits.
README-api.mddescribes the setup.appserver.py --direct-portsis for a proxy that routes by port: the
pages then keepwss://host:444N/andhttps://host:8085. Without it the
pages behave as described above.
Training
From Bob Salita (#205):
- The bidding networks train with the data on the GPU: 30 epochs of both
networks on 3.8 million examples take about 16 minutes instead of 5 hours
on an RTX 5080, giving equivalent models. - The conversion of training data to binary runs in worker processes, about
13 times faster, with byte-identical output. eval_bidding_nn.pyis five times faster.