From de3684953d8ea1d155ffa0497e397bedaf5335ab Mon Sep 17 00:00:00 2001 From: Benjamin Berman Date: Fri, 14 Nov 2025 18:16:21 -0800 Subject: [PATCH] Revert "Ensure web.Application is instrumented, and ensure the latest aiohttp is installed in containers" This reverts commit fa3eea9a18c7f80a4937c37bbc6cadcf2410490e. --- comfy/api_server/routes/internal/internal_routes.py | 6 ------ comfy/cmd/main_pre.py | 5 +---- comfy/cmd/server.py | 8 -------- comfy/distributed/distributed_prompt_worker.py | 6 ------ pyproject.toml | 7 +++---- 5 files changed, 4 insertions(+), 28 deletions(-) diff --git a/comfy/api_server/routes/internal/internal_routes.py b/comfy/api_server/routes/internal/internal_routes.py index 5d0d4f3f2..9b0c4dc61 100644 --- a/comfy/api_server/routes/internal/internal_routes.py +++ b/comfy/api_server/routes/internal/internal_routes.py @@ -70,12 +70,6 @@ class InternalRoutes: def get_app(self): if self._app is None: - # Manually apply instrumentation to ensure web.Application is instrumented - from opentelemetry.instrumentation.aiohttp_server import AioHttpServerInstrumentor - instrumentor = AioHttpServerInstrumentor() - if not instrumentor.is_instrumented_by_opentelemetry: - instrumentor.instrument() - self._app = web.Application() self.setup_routes() self._app.add_routes(self.routes) diff --git a/comfy/cmd/main_pre.py b/comfy/cmd/main_pre.py index 5788f74c9..7c06e4cee 100644 --- a/comfy/cmd/main_pre.py +++ b/comfy/cmd/main_pre.py @@ -15,6 +15,7 @@ import shutil import warnings import fsspec +from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor from .. import options from ..app import logger @@ -129,8 +130,6 @@ def _create_tracer(): from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS from opentelemetry.instrumentation.aiohttp_server import AioHttpServerInstrumentor from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor - from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor - from ..tracing_compatibility import ProgressSpanSampler from ..tracing_compatibility import patch_spanbuilder_set_channel @@ -164,8 +163,6 @@ def _create_tracer(): provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS)) - trace.set_tracer_provider(provider) - # makes this behave better as a library return trace.get_tracer(args.otel_service_name, tracer_provider=provider) diff --git a/comfy/cmd/server.py b/comfy/cmd/server.py index bc9c7a8e6..7a4be89a8 100644 --- a/comfy/cmd/server.py +++ b/comfy/cmd/server.py @@ -252,14 +252,6 @@ class PromptServer(ExecutorToClientProgress): middlewares.append(create_origin_only_middleware()) max_upload_size = round(args.max_upload_size * 1024 * 1024) - - # Manually apply instrumentation to ensure web.Application is instrumented - # This works around the import caching bug in opentelemetry-instrumentation-aiohttp-server - from opentelemetry.instrumentation.aiohttp_server import AioHttpServerInstrumentor - instrumentor = AioHttpServerInstrumentor() - if not instrumentor.is_instrumented_by_opentelemetry: - instrumentor.instrument() - self.app: web.Application = web.Application(client_max_size=max_upload_size, handler_args={'max_field_size': 16380}, middlewares=middlewares) diff --git a/comfy/distributed/distributed_prompt_worker.py b/comfy/distributed/distributed_prompt_worker.py index 998e2ad2d..d831ba734 100644 --- a/comfy/distributed/distributed_prompt_worker.py +++ b/comfy/distributed/distributed_prompt_worker.py @@ -53,12 +53,6 @@ class DistributedPromptWorker: return web.Response(text="UNHEALTHY: RabbitMQ connection is not healthy", status=503) async def _start_health_check_server(self): - # Manually apply instrumentation to ensure web.Application is instrumented - from opentelemetry.instrumentation.aiohttp_server import AioHttpServerInstrumentor - instrumentor = AioHttpServerInstrumentor() - if not instrumentor.is_instrumented_by_opentelemetry: - instrumentor.instrument() - app = web.Application() app.router.add_get('/health', self._health_check) diff --git a/pyproject.toml b/pyproject.toml index 174afa215..f6e6f375c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,8 @@ dependencies = [ "peft>=0.10.0", "torchinfo", "safetensors>=0.4.2", - "aiohttp>=3.13.2", - "yarl>=1.22.0", + "aiohttp>=3.11.8", + "yarl>=1.9.4", "accelerate>=0.25.0", "pyyaml>=6.0", "scikit-image>=0.20.0", @@ -119,8 +119,7 @@ dependencies = [ "requests_cache", "universal_pathlib", # yanked propcache is omitted - # we want this upgraded - "propcache>=0.4.1", + "propcache!=0.4.0", ] [build-system]