Torchserve stopped. Failed to bind. Address already in use

I am trying to get Torchserve running locally on my Ubuntu Machine. But I encounter this error after loading the model:

2021-03-18 18:31:38,285 [INFO ] main org.pytorch.serve.ModelServer - Torchserve stopped. Failed to bind
        at io.grpc.internal.ServerImpl.start(
        at io.grpc.internal.ServerImpl.start(
        at org.pytorch.serve.ModelServer.startGRPCServer(
        at org.pytorch.serve.ModelServer.startGRPCServers(
        at org.pytorch.serve.ModelServer.startAndWait(
        at org.pytorch.serve.ModelServer.main(
Caused by:$NativeIoException: bind(..) failed: Address already in use
Exception in thread "Thread-0" java.util.concurrent.RejectedExecutionException: event executor terminated
        at io.netty.util.concurrent.SingleThreadEventExecutor.reject(
        at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(
        at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(
        at io.netty.util.concurrent.SingleThreadEventExecutor.execute(
        at io.netty.util.concurrent.SingleThreadEventExecutor.execute(
        at org.pytorch.serve.ModelServer.stop(
        at org.pytorch.serve.ModelServer$

I dont have anything running on 9000, 9001, 8081, 8082 or any other port.

Following is my config:

Torchserve version: 0.3.0
TS Home: /home/pc/anaconda3/envs/torch/lib/python3.7/site-packages
Current directory: /home/pc/lezwon
Temp directory: /tmp
Number of GPUs: 2
Number of CPUs: 20
Max heap size: 16008 M
Python executable: /home/pc/anaconda3/envs/torch/bin/python
Config file:
Inference address:
Management address:
Metrics address:
Model Store: /home/pc/lezwon/model_store
Initial Models: car_roi=car_roi.mar
Log dir: /home/pc/lezwon/logs
Metrics dir: /home/pc/lezwon/logs
Netty threads: 0
Netty client threads: 0
Default workers per model: 2
Blacklist Regex: N/A
Maximum Response Size: 6553500
Maximum Request Size: 6553500
Prefer direct buffer: false
Allowed Urls: [file://.*|http(s)?://.*]
Custom python dependency for model allowed: false
Metrics report format: prometheus
Enable metrics API: true

Torchserve runs fine through a docker container. Only fails locally. Any help here would be appreciated. Thanks.

Fixed it. There was AnyDesk running on port 7070. Closed it and it now works fine. :slight_smile:

1 Like