Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server crashes in production with `WorkerThread - IllegalStateException error' #3091

Closed
MaelitoP opened this issue Apr 17, 2024 · 1 comment

Comments

@MaelitoP
Copy link

MaelitoP commented Apr 17, 2024

Hello,

To make some test on the TorchServe I've sent 100 requests concurrently using the command below.

$ ./ghz --proto=./proto/inference.proto -i ./proto --insecure -c 100 -z1m  -d '{"model_name": "distilroberta", "model_version": "1.0", "input": {"data": "c29tZURhdGFJbkJhc2U2NA==" }}' --call=org.pytorch.serve.grpc.inference.InferenceAPIsService.Predictions localhost:4089

Summary:
  Count:        5509
  Total:        60.04 s
  Slowest:      1.46 s
  Fastest:      123.48 ms
  Average:      1.09 s
  Requests/sec: 91.76

Response time histogram:
  123.478  [1]    |
  257.027  [18]   |
  390.575  [14]   |
  524.123  [13]   |
  657.672  [12]   |
  791.220  [14]   |
  924.769  [33]   |
  1058.317 [127]  |∎
  1191.865 [5116] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  1325.414 [59]   |
  1458.962 [5]    |

Latency distribution:
  10 % in 1.07 s 
  25 % in 1.09 s 
  50 % in 1.10 s 
  75 % in 1.12 s 
  90 % in 1.14 s 
  95 % in 1.15 s 
  99 % in 1.19 s 

Status code distribution:
  [OK]            5412 responses   
  [Unavailable]   97 responses     

Error distribution:
  [97]   rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:6110->127.0.0.1:4089: use of closed network connection 

The server crashes giving the error below:

2024-04-17T08:29:23,524 [ERROR] W-9005-distilroberta_1.0 org.pytorch.serve.wlm.WorkerThread - IllegalStateException error
java.lang.IllegalStateException: Stream was terminated by error, no further calls are allowed
        at com.google.common.base.Preconditions.checkState(Preconditions.java:502) ~[model-server.jar:?]
        at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(ServerCalls.java:374) ~[model-server.jar:?]
        at org.pytorch.serve.job.GRPCJob.response(GRPCJob.java:130) ~[model-server.jar:?]
        at org.pytorch.serve.wlm.BatchAggregator.sendResponse(BatchAggregator.java:103) ~[model-server.jar:?]
        at org.pytorch.serve.wlm.WorkerThread.run(WorkerThread.java:238) [model-server.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]
2024-04-17T08:29:23,526 [INFO ] grpc-default-executor-52 ACCESS_LOG - /172.23.0.1:24928 "gRPC org.pytorch.serve.grpc.inference.InferenceAPIsService/Predictions HTTP/2.0" 1 930
2024-04-17T08:29:23,524 [WARN ] grpc-default-executor-44 org.pytorch.serve.grpcimpl.InferenceImpl - grpc client call already cancelled
2024-04-17T08:29:23,524 [ERROR] W-9005-distilroberta_1.0 org.pytorch.serve.wlm.WorkerThread - IllegalStateException error
java.lang.IllegalStateException: Stream was terminated by error, no further calls are allowed
        at com.google.common.base.Preconditions.checkState(Preconditions.java:502) ~[model-server.jar:?]
        at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(ServerCalls.java:374) ~[model-server.jar:?]
        at org.pytorch.serve.job.GRPCJob.response(GRPCJob.java:130) ~[model-server.jar:?]
        at org.pytorch.serve.wlm.BatchAggregator.sendResponse(BatchAggregator.java:103) ~[model-server.jar:?]
        at org.pytorch.serve.wlm.WorkerThread.run(WorkerThread.java:238) [model-server.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]

Configuration:

[DEFAULT]
grpc_inference_port=7070
grpc_management_port=7071
metrics_address=http://127.0.0.1:8082
enable_metrics_api=true
metrics_config=deployments/metrics.yaml
metrics_mode=prometheus
vmargs=-Dlog4j.configurationFile=file:deployments/log4j2.xml
async_logging=true
models={"distilroberta": {"1.0": {"defaultVersion": true,"marName": "distilroberta.mar","minWorkers": 3,"maxWorkers": 6,"batchSize": 1}}}

If it can help, here is the hardware specs:

$ lscpu 
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  12
  On-line CPU(s) list:   0-11
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        Intel(R) Corporation
  Model name:            Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz
    BIOS Model name:     Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz To Be Filled By O.E.M. CPU @ 3.2GHz
    BIOS CPU family:     179
    CPU family:          6
    Model:               158
    Thread(s) per core:  2
    Core(s) per socket:  6
    Socket(s):           1
    Stepping:            10
    CPU(s) scaling MHz:  33%
    CPU max MHz:         4500.0000
    CPU min MHz:         800.0000
    BogoMIPS:            6599.98
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtp
                         r pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsave
                         opt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Virtualization features: 
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   192 KiB (6 instances)
  L1i:                   192 KiB (6 instances)
  L2:                    1.5 MiB (6 instances)
  L3:                    12 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-11
  
  
$ free -m
               total        used        free      shared  buff/cache   available
Mem:           31879       23919         291           2        8108        7959
Swap:           1023           1        1022

model-container $ java -XshowSettings:system -version
Operating System Metrics:
    Provider: cgroupv2
    Effective CPU Count: 12
    CPU Period: 100000us
    CPU Quota: -1
    CPU Shares: -1
    List of Processors: N/A
    List of Effective Processors, 12 total: 
    0 1 2 3 4 5 6 7 8 9 10 11 
    List of Memory Nodes: N/A
    List of Available Memory Nodes, 1 total: 
    0 
    Memory Limit: Unlimited
    Memory Soft Limit: 0.00K
    Memory & Swap Limit: Unlimited
    Maximum Processes Limit: 4915

openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Ubuntu-120.04.1)
OpenJDK 64-Bit Server VM (build 17.0.10+7-Ubuntu-120.04.1, mixed mode, sharing)

Does anyone have any idea why the server crashes?

Thank you for your help ❤️

I can give you a thread dump when the crash occures if needed btw

@agunapal
Copy link
Collaborator

Hi @MaelitoP Is this resolved? Can you please share your handler code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants