fix: replace asyncio subprocess proxy with thread-based Popen proxy
Some checks failed
Build and Deploy iLSP / test (push) Failing after 12s
Build and Deploy iLSP / build-and-deploy (push) Has been skipped

asyncio subprocess PIPE unreliable for long-lived stdio bridging. Use Popen + threads instead. Also fix smoke_test.sh stdin handling.
This commit is contained in:
Henrik Jess Nielsen
2026-05-10 13:02:52 +02:00
parent c550a4963e
commit 6385e159ff
5 changed files with 175 additions and 139 deletions

View File

@@ -11,6 +11,7 @@ import asyncio
import logging
import os
import signal
import threading
from aiohttp import web
@@ -58,13 +59,23 @@ async def main_async() -> None:
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
logging.getLogger("ilsp.bicep_lsp.proxy").setLevel(logging.DEBUG)
# Pre-warm caches
logger.info("Pre-warming catalogs…")
from .bicep_lsp.modules import BicepModuleCatalog
await asyncio.gather(
PypiCatalog.start_background_refresh(),
BicepModuleCatalog.start_background_refresh(),
)
# Start Bicep LSP proxy in a daemon thread (blocking socket server)
threading.Thread(
target=serve_bicep,
args=(BICEP_LSP_PORT,),
daemon=True,
).start()
# Build health app
health_app = await _health_app()
runner = web.AppRunner(health_app)
@@ -73,11 +84,8 @@ async def main_async() -> None:
await site.start()
logger.info("Health endpoint on http://0.0.0.0:%d/health", HEALTH_PORT)
# Run all services
await asyncio.gather(
_serve_python_lsp(PYTHON_LSP_PORT),
serve_bicep(BICEP_LSP_PORT),
)
# Run remaining asyncio services
await _serve_python_lsp(PYTHON_LSP_PORT)
def main() -> None: