latest polishing and bug hunting

This commit is contained in:
Eric 2022-12-22 21:44:54 -08:00
parent c296d965a2
commit d2ca02e07f
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
14 changed files with 152 additions and 59 deletions

View File

@ -420,7 +420,7 @@
"assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/60/ad/38269b7f1c7dc20cb9a506cd0681",
"assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/72/85/d6fc4d16b7081d91fba2850b5b10",
"assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/e9/ae/1d674d0c086eaa0bd1c3b1db0505",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/a8/a2/8c6816daac85d0b899a324509cf6",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/8c/16/c8b51005b8ed3a5046264ac667f4",
"assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/92/43/36b34307575f6d6219bdf4898e18",
"assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/61/03/89070ca765e06da3a419a579f503",
"assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/aa/ed/4bd02af3cffbd4c9c4be532fb1fe",
@ -4008,51 +4008,51 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/1c/77/ac670a5118abdf8a7687af0e159b",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b2/8a/31e68e8aeb4a440a98cdb37e688e",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7e/c2/ed0e710cd33e9a96c7f54fdf400a",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/62/35/37d0f605248971a7d270914c0e61",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/91/a1/5da5cec236aa862f7f92f89783cd",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/37/bb/b6bfe02bbd14a9c2d02fb782e4a9",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/05/38/a9adca329b4a147d58dd81a714ac",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2c/03/e562ae1a5cc7be268e1bf0ccc4c0",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c9/d5/066f05c777e200dd73084f0a1c25",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f7/6f/239efdb4e9e06cc0256f74da3aa8",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/77/48d470740edb84a271bfb18c2a16",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e1/2f/d8e39443dd972ea41fb0c241e8fd",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/32/9b/9d76eef13898e654b088698512d7",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/34/94/4abfe29e9b0443b292c53659a133",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/43/b1/2a8098e867f5d2a2cc086a4fb3f5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/b6/0700636b968985ecc9ff1d3bd28e",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/db/ee/569470160da9dff657538c06ce7b",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/91/f9/6ec6bf4f8496ec4f71b3716db983",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/66/8a/7f50eede3fb6b6d7a655e4613f2e",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/d4/40/1121fb6089b698565347acec66f6",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/06/3b/0d289dd9a1170f750859e1c35b99",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f5/70/38d78023e0b99fdbe6ee29edd809",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/35/92/f2e39484904878e7eb9f5b3aff60",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6e/c5/6a81e0fc6027de9eca1c4a63143d",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/88/b5/e58450cec94d586f3d824f53c580",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/66/af/cf144d78359363ba027f2bd98a55",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9d/96/78f5d0d1e9249c71f018d84d9b24",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/d1/0f90ecfd6631b5476da915a76c55",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/bc/ec9ef218fb8065b58182493c981d",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/6b/b2a4eb26f043bb474e7e7e958470",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/e1/93f3afbc17ba6405cc970b559bb2",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/79/d2/f3b45d1aca8056c6cb951adc99ba",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4b/40/2ad8e00744d0b821e86fc42fc1f6",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8d/55/9876fecbe5d5076879b08d441665",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/f1/6c795ec50a26c24c734c5e0168b4",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7d/44/03c734fb003671a15182e8446a44",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7b/65/cadda8309ad9a4360a6930f05df8",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/41/a5/13590a172a2bf749bf419f67ce9f",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/76/26/0f89328b9e4554a5e656b1ead2d1",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/4b/da/b914c9e05be25d475155727046f4",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/c3/fb/78fe613f999fc6a9291c7141aeb8",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f8/b2/cf697fd62a3f0bdbd248173551f0",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d3/56/62b48ba16afb6023e730c9a42e75",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/4c/6e/009f37e5b619ce32e398b8039f62",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/26/03/2ee19e3130a7455efe5c9f78cd93",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/25/77/8093dfffddaa80cd513ddaa61867",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/76/00/aadc5cc5fa6a1b47535571f53e0c",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8a/c5/e18feec0e01cef4f4e95fb0808ec",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/de/73/3238fef727dbe8e13fc01bacccdf",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e3/16/33500fbc1be37a7ab0beb9ea1353",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/23/75/f18db49e8bf625a4d140cfddc0eb",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/13/92/649fec7372f2cc6513d81df7ac03",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ba/aa/8a853018d236f1f8c70bfd6d830a",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/36/908f74e219d570e16ce72520b0f9",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/75/0a/6bdecafd1f0a1d4613697e1ad71d",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/55/18e339d10407ec858fee58fc9d5a",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/d6/68df4d180d1eb83119a8a1d2cde3",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/51/3f2217d1f0640ec63e7499641001",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6a/0e/b42051f6e252b278279d2bf0ce65",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8f/8d/2dcdfbc13d984ea6c62ef5e07600",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/63/32/555ad0de811a0af52f704f215309",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/60/39/8589f26d7619a11c53f452d4a808",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/99/a4/2e40eb7af11d25d889af56fa73dc",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a5/b1/34cd5f68321e318a18d3bf2a6651",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ec/8b/b08ad5030780c2554291c5ddf7b4",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/96/ae/28d1c19d92db131315fa2d42d772",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e9/02/eb6c1b076dd366fcdbb69c0aa85a",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ff/2b/5e85ad35d9305d60adbdc53dbb6e",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5b/fb/074697e51ab8a28604788be2b3bb",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0b/26/7a9c1094bb1ffea16a60424251e1",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fb/89/55c61946fc5cfa6e1154450b84e8",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b9/33/7d35c3ff242b7ad72257b9a132ec",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9c/5e/de343f0a5b9ada35352ba10f5598",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a7/da/be3ad1176399531ce6e634f8700f",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/2e/f5710315b4a86e6dd2a3806f0b9a",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bd/15/c896646cdff25290761c402d3b21",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/f1/e9cafcb4a0b721a48027763e6b50",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b7/ec/0ad3db1b805b6d3067893326e8d8",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/88/22c1bff0c944447bf15cadb835a8",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/fc/bbf70a63d29d536d8511474309c6",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d2/c1/ed8083e560d9466547d1da458118",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/10/8a/534c2c99f6d314631046f0f2afc2",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/3f/7b/669a2a9f4785ca31c1dec187a2a5",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/36/7e/5c0a226564142afded25c4b75999",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/c1/af/624497502e114de73ebac45a9fd4",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/3c/be/2245d4a6302fd98af97362f2af64",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/0f/6d/ffd0a160ce991e724552a4bde26d",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/0c/d5/172d21269794aa7809fd1c63eec5",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/b2/d9/f3333d9e169a62ae8e1bfc12c1d9",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/d2/e7/ff5143a503539e10470b2e96e3aa",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/23/ce/68396b1b7ec6d2f8425902148140",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/2d/4f/f4fe67827f36cd59cd5193333a02",
"src/ballistica/generated/python_embedded/bootstrap_monolithic.inc": "https://files.ballistica.net/cache/ba1/ef/c1/aa5f1aa10af89f5c0b1e616355fd"
}

View File

@ -1,4 +1,4 @@
### 1.7.17 (build 20973, api 7, 2022-12-20)
### 1.7.17 (build 20982, api 7, 2022-12-22)
- V2 accounts now show a 'Unlink Legacy (V1) Accounts' button in account settings if they have any old v1 links present. This can be used to clear out old links to replace them with V2 links which work correctly with V2 accounts.
- `ba.internal.dump_tracebacks()` is now `ba.internal.dump_app_state()` and `ba.internal.log_dumped_tracebacks()` is now `ba.internal.log_dumped_app_state()`. This reflects the fact that these calls may be expanded to include other app state in the future (C++ layer thread states, etc.).
- Added `ba.app.health_monitor` which will dump app state if the logic thread ever stops responding for 5+ seconds while the app is running (to help diagnose deadlock situations).

View File

@ -1 +1 @@
307626381968915875246137499583097815878
71864217068887285722858773141608052966

View File

@ -392,12 +392,12 @@ class AppHealthMonitor:
def __init__(self) -> None:
assert _ba.in_logic_thread()
self._running = True
self._thread = Thread(target=self._bg_thread_main, daemon=True)
self._thread = Thread(target=self._app_monitor_thread_main, daemon=True)
self._thread.start()
self._response = False
self._first_check = True
def _bg_thread_main(self) -> None:
def _app_monitor_thread_main(self) -> None:
try:
self._monitor_app()
@ -467,3 +467,60 @@ class AppHealthMonitor:
"""Should be called when the app resumes."""
assert _ba.in_logic_thread()
self._running = True
def on_too_many_file_descriptors() -> None:
"""Called when too many file descriptors are open; trying to debug."""
from ba._generated.enums import TimeType
real_time = _ba.time(TimeType.REAL)
def _do_log() -> None:
import subprocess
pid = os.getpid()
out = f'TOO MANY FDS at {real_time}.\nWe are pid {pid}\n'
out += (
'FD Count: '
+ subprocess.run(
f'ls -l /proc/{pid}/fd | wc -l',
shell=True,
check=False,
capture_output=True,
).stdout.decode()
+ '\n'
)
out += (
'lsof output:\n'
+ subprocess.run(
f'lsof -p {pid}',
shell=True,
check=False,
capture_output=True,
).stdout.decode()
+ '\n'
)
logging.warning(out)
Thread(target=_do_log, daemon=True).start()
# import io
# from efro.debug import printtypes
# with io.StringIO() as fstr:
# fstr.write('Too many FDs.\n')
# printtypes(file=fstr)
# fstr.seek(0)
# logging.warning(fstr.read())
# import socket
# objs: list[Any] = []
# for obj in gc.get_objects():
# if isinstance(obj, socket.socket):
# objs.append(obj)
# test = open('/Users/ericf/.zshrc', 'r', encoding='utf-8')
# reveal_type(test)
# print('FOUND', len(objs))

View File

@ -47,7 +47,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary
# version than we expect.
expected_build = 20973
expected_build = 20982
running_build: int = env['build_number']
if running_build != expected_build:
print(

View File

@ -53,8 +53,15 @@ def get_store_item_display_size(item_name: str) -> tuple[float, float]:
if item_name.startswith('characters.'):
return 340 * 0.6, 430 * 0.6
if item_name in ['pro', 'upgrades.pro', 'merch']:
from ba._generated.enums import UIScale
return 650 * 0.9, 500 * (
0.72 if _ba.app.config.get('Merch Link') else 0.85
0.72
if (
_ba.app.config.get('Merch Link')
and _ba.app.ui.uiscale is UIScale.SMALL
)
else 0.85
)
if item_name.startswith('maps.'):
return 510 * 0.6, 450 * 0.6

View File

@ -908,7 +908,10 @@ class StoreBrowserWindow(ba.Window):
)
section['v_spacing'] = (
-25
if self._tab == 'extras'
if (
self._tab == 'extras'
and uiscale is ba.UIScale.SMALL
)
else -17
if self._tab == 'characters'
else 0

View File

@ -32,7 +32,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20973;
const int kAppBuildNumber = 20982;
const char* kAppVersion = "1.7.17";
// Our standalone globals.

View File

@ -70,11 +70,11 @@ auto Logging::V1CloudLog(const std::string& msg) -> void {
std::scoped_lock lock(g_app->v1_cloud_log_mutex);
if (!g_app->v1_cloud_log_full) {
(g_app->v1_cloud_log) += (msg + "\n");
if ((g_app->v1_cloud_log).size() > 10000) {
if ((g_app->v1_cloud_log).size() > 25000) {
// Allow some reasonable overflow for last statement.
if ((g_app->v1_cloud_log).size() > 100000) {
if ((g_app->v1_cloud_log).size() > 250000) {
// FIXME: This could potentially chop up utf-8 chars.
(g_app->v1_cloud_log).resize(100000);
(g_app->v1_cloud_log).resize(250000);
}
g_app->v1_cloud_log += "\n<max log size reached>\n";
g_app->v1_cloud_log_full = true;

View File

@ -2,6 +2,7 @@
#include "ballistica/networking/network_reader.h"
#include "ballistica/core/thread.h"
#include "ballistica/generic/json.h"
#include "ballistica/input/remote_app.h"
#include "ballistica/logic/connection/connection_set.h"
@ -175,6 +176,25 @@ static auto HandleGameQuery(const char* buffer, size_t size,
}
}
auto NetworkReader::CheckFDThreshold(int val) -> void {
if (passed_fd_threshold_) {
return;
}
// Let's trigger when we pass 2/3 of the FD limit.
if (val < FD_SETSIZE * 2 / 3) {
return;
}
// If we pass the threshold, do a one-time dump of info
// to try and debug it.
passed_fd_threshold_ = true;
g_logic->thread()->PushCall([val] {
assert(InLogicThread());
g_python->obj(Python::ObjID::kOnTooManyFileDescriptorsCall).Call();
});
}
auto NetworkReader::RunThread() -> int {
if (!HeadlessMode()) {
remote_server_ = std::make_unique<RemoteAppServer>();
@ -202,6 +222,7 @@ auto NetworkReader::RunThread() -> int {
// Try to get a clean error instead of a crash if we exceed our
// open file descriptor limit (except on windows where FD_SETSIZE
// is apparently a dummy value).
CheckFDThreshold(sd4_);
if (sd4_ < 0 || sd4_ >= FD_SETSIZE) {
FatalError("Socket/File Descriptor Overflow (sd4="
+ std::to_string(sd4_) + ", FD_SETSIZE="
@ -216,6 +237,7 @@ auto NetworkReader::RunThread() -> int {
// Try to get a clean error instead of a crash if we exceed our
// open file descriptor limit (except on windows where FD_SETSIZE
// is apparently a dummy value).
CheckFDThreshold(sd6_);
if (sd6_ < 0 || sd6_ >= FD_SETSIZE) {
FatalError("Socket/File Descriptor Overflow (sd6="
+ std::to_string(sd6_) + ", FD_SETSIZE="

View File

@ -32,6 +32,7 @@ class NetworkReader {
auto sd6() const { return sd6_; }
private:
auto CheckFDThreshold(int val) -> void;
auto OpenSockets() -> void;
auto PokeSelf() -> void;
auto RunThread() -> int;
@ -53,6 +54,7 @@ class NetworkReader {
bool paused_{};
std::mutex paused_mutex_;
std::condition_variable paused_cv_;
bool passed_fd_threshold_{};
};
} // namespace ballistica

View File

@ -368,6 +368,7 @@ class Python {
kImplicitSignInCall,
kImplicitSignOutCall,
kLoginAdapterGetSignInTokenResponseCall,
kOnTooManyFileDescriptorsCall,
kLast // Sentinel; must be at end.
};

View File

@ -146,4 +146,5 @@ def get_binding_values() -> tuple[Any, ...]:
_hooks.implicit_sign_in, # kImplicitSignInCall
_hooks.implicit_sign_out, # kImplicitSignOutCall
_hooks.login_adapter_get_sign_in_token_response, # kLoginAdapterGetSignInTokenResponseCall
_apputils.on_too_many_file_descriptors, # kOnTooManyFileDescriptorsCall
) # yapf: disable

View File

@ -148,7 +148,7 @@ class LogHandler(logging.Handler):
self._cache_lock = Lock()
self._printed_callback_error = False
self._thread_bootstrapped = False
self._thread = Thread(target=self._thread_main, daemon=True)
self._thread = Thread(target=self._log_thread_main, daemon=True)
self._thread.start()
# Spin until our thread is up and running; otherwise we could
@ -165,7 +165,7 @@ class LogHandler(logging.Handler):
with self._callbacks_lock:
self._callbacks.append(call)
def _thread_main(self) -> None:
def _log_thread_main(self) -> None:
self._event_loop = asyncio.new_event_loop()
# NOTE: if we ever use default threadpool at all we should allow
# setting it for our loop.