Skip to content

[Bug]: Services without a gateway don't work #2224

@jvstme

Description

@jvstme

Steps to reproduce

Run any service on a VM-based backend without a gateway and try requesting the service.

> cat .dstack.yml
type: service
name: test-service
gateway: off
image: nginx
port: 80
auth: false

> dstack apply
test-service provisioning completed (running)
Service is published at:
  http://localhost:3000/proxy/services/main/test-service/

> curl http://localhost:3000/proxy/services/main/test-service/

Actual behaviour

> curl http://localhost:3000/proxy/services/main/test-service/
Internal Server Error

Expected behaviour

Successful response.

dstack version

The issue was introduced in 0.18.36

Server logs

File "/src/dstack/_internal/server/services/proxy/routers/service_proxy.py", line 33, in service_reverse_proxy
    return await service_proxy.proxy(project_name, run_name, path, request, auth, repo)
  File "/src/dstack/_internal/server/services/proxy/services/service_proxy.py", line 36, in proxy
    client = await get_service_replica_client(service, repo)
  File "/src/dstack/_internal/proxy/lib/services/service_connection.py", line 149, in get_service_replica_client
    connection = await service_replica_connection_pool.get_or_add(project, service, replica)
  File "/src/dstack/_internal/proxy/lib/services/service_connection.py", line 105, in get_or_add
    await connection.open()
  File "/src/dstack/_internal/proxy/lib/services/service_connection.py", line 75, in open
    await self._tunnel.aopen()
  File "/src/dstack/_internal/core/services/ssh/tunnel.py", line 219, in aopen
    raise get_ssh_error(stderr)
dstack._internal.core.errors.SSHError: Connection closed by UNKNOWN port 65535

Workaround

Use a gateway or use container-based backends: RunPod, Vast.ai, Kubernetes.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmajor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions