Load testing GRPC protocol: context deadline exceeded

Hi,

I am trying to run a load test with GRPC but I get this following error : “context deadline exceeded”.

Here is my script:

import grpc from 'k6/net/grpc';


const client = new grpc.Client();

client.load([], 'DataFlowGrpcSubscriber.proto');

export default () => {
  client.connect('host:port', {
    //plaintext: true,
    //reflect:true
  });

  const data = { ProviderRef: 'ICAR' };
  const params = { headers: { 'apikey': 'key' } };
  const response = client.invoke('DataFlowGrpc.DataFlowSubscriber/SubscribeParkingAvailabilityMessage', data,params);

  check(response, {
    'status is OK': (r) => r && r.status === grpc.StatusOK,
  });

  console.log(JSON.stringify(response.message));

  client.close();
  sleep(1);
};

Then I run my test : k6 run test.js and I get this output:

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: test.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

ERRO[0060] context deadline exceeded
        at go.k6.io/k6/js/common.Bind.func1 (native)
        at file:///C:/Users/nmele/Desktop/K6/GRPC/netcoreapp3.1/test.js:9:55(5)  executor=per-vu-iterations scenario=default source=stacktrace

running (01m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  01m00.0s/10m0s  1/1 iters, 1 per VU

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=1m0s min=1m0s med=1m0s max=1m0s p(90)=1m0s p(95)=1m0s
     iterations...........: 1   0.016659/s
     vus..................: 1   min=1      max=1
     vus_max..............: 1   min=1      max=1

Can someone help me on what is happening?

Many thanks

HI @nawel , welcome to the community forum :tada:

From the looks of it the client.connect takes 1 minute and then aborts, probably because of a timeout, unfortunately the message isn’t really clear on that. You can try provides timeout: "2m" or something like that (along the plaintext and reflect arguments).

But if it takes 1 minute to make the connection, I would expect something else is wrong. Can you confirm with another tool that you can connect at all? Or see some server logs because I would expect that you hit some firewall or (if on windows) antivirus that just drops the connection and k6 never actually connects to the server.