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

Seeing Connectivity Issue in k6 Tool on using latest K6 Version(0.49.0) as opposed to older K6 Version(0.31.1) #3620

Closed
srikr opened this issue Mar 3, 2024 · 13 comments
Assignees
Labels

Comments

@srikr
Copy link

srikr commented Mar 3, 2024

Brief summary

K6 Javascript Used
cat http.js import http from "k6/http"; import { check } from "k6"; export var options = { hosts: { 'SNI-bot-mgmt-static-waf-policy-learning-8-148-1-ch-0.botmgmttest.net' : '172.16.28.89' } }; export default function() { var param = { headers: {'Content-Type': 'application/json', 'Accept': 'text/html'} }; var data11 = JSON.stringify({ "name1":"aaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyz" }); check(http.post("https://SNI-bot-mgmt-static-waf-policy-learning-8-148-1-ch-0.botmgmttest.net:443/psm/POST/post1.php", data11, param), { "status is 200": (r) => r.status == 200, "protocol is HTTP/1.1": (r) => r.proto == "HTTP/1.1", }); }
Traffic Works fine for k6 version 31:
k6.31 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js

Traffic doesn't Work fine for k6 version 49(latest):
k6 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js

Below are the version outputs of K6 Version command
Working K6 Version:
k6.31 version k6 v0.31.1 (2021-03-17T13:23:23+0000/e9d8349, go1.15.8, linux/amd64)
Non Working K6 Version:
k6 version k6 v0.49.0 (commit/b5328aa782, go1.21.6, linux/amd64)

k6 version

v0.49.0

OS

Ubuntu 16.04

Docker version and image (if applicable)

No response

Steps to reproduce the problem

K6 Javascript Used
cat http.js import http from "k6/http"; import { check } from "k6"; export var options = { hosts: { 'SNI-bot-mgmt-static-waf-policy-learning-8-148-1-ch-0.botmgmttest.net' : '172.16.28.89' } }; export default function() { var param = { headers: {'Content-Type': 'application/json', 'Accept': 'text/html'} }; var data11 = JSON.stringify({ "name1":"aaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyz" }); check(http.post("https://SNI-bot-mgmt-static-waf-policy-learning-8-148-1-ch-0.botmgmttest.net:443/psm/POST/post1.php", data11, param), { "status is 200": (r) => r.status == 200, "protocol is HTTP/1.1": (r) => r.proto == "HTTP/1.1", }); }
Traffic Works fine for k6 version 31:
k6.31 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js

Traffic doesn't Work fine for k6 version 49(latest):
k6 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js

Below are the version outputs of K6 Version command
Working K6 Version:
k6.31 version k6 v0.31.1 (2021-03-17T13:23:23+0000/e9d8349, go1.15.8, linux/amd64)
Non Working K6 Version:
k6 version k6 v0.49.0 (commit/b5328aa782, go1.21.6, linux/amd64)

Expected behaviour

Latest k6 Version should work like Old K6 Version

Actual behaviour

K6 Version 31 Output:
`k6.31 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js

      /\      |‾‾| /‾‾/   /‾‾/
 /\  /  \     |  |/  /   /  /
/  \/    \    |     (   /   ‾‾\

/ \ | |\ \ | (‾) |
/ __________ \ |__| _\ ____/ .io

execution: local
script: /home/aviuser/K6JS/http.js
output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 40s max duration (incl. graceful stop):
* default: 1 looping VUs for 10s (gracefulStop: 30s)
running (10.0s), 0/1 VUs, 1495 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 10s

 ✓ status is 200
 ✓ protocol is HTTP/1.1

 checks.........................: 100.00% ✓ 2990 ✗ 0
 data_received..................: 1.0 MB  103 kB/s
 data_sent......................: 895 kB  90 kB/s
 http_req_blocked...............: avg=25.54µs min=1.2µs   med=1.78µs  max=10.01ms  p(90)=2.35µs  p(95)=2.63µs
 http_req_connecting............: avg=2.9µs   min=0s      med=0s      max=1.35ms   p(90)=0s      p(95)=0s
 http_req_duration..............: avg=3.01ms  min=2.53ms  med=2.93ms  max=16.73ms  p(90)=3.25ms  p(95)=3.63ms
   { expected_response:true }...: avg=3.01ms  min=2.53ms  med=2.93ms  max=16.73ms  p(90)=3.25ms  p(95)=3.63ms
 http_req_failed................: 0.00%   ✓ 0    ✗ 1495
 http_req_receiving.............: avg=37.78µs min=19.52µs med=37.38µs max=198.43µs p(90)=47.52µs p(95)=51.44µs
 http_req_sending...............: avg=15.02µs min=6.36µs  med=15.34µs max=95.19µs  p(90)=17.75µs p(95)=18.57µs
 http_req_tls_handshaking.......: avg=20.26µs min=0s      med=0s      max=9.65ms   p(90)=0s      p(95)=0s
 http_req_waiting...............: avg=2.96ms  min=2.49ms  med=2.87ms  max=16.68ms  p(90)=3.19ms  p(95)=3.58ms
 http_reqs......................: 1495    149.429841/s
 iteration_duration.............: avg=6.68ms  min=2.7ms   med=6.65ms  max=20.4ms   p(90)=6.86ms  p(95)=7.2ms
 iterations.....................: 1495    149.429841/s
 vus............................: 1       min=1  max=1
 vus_max........................: 1       min=1  max=1`

K6 Version 49 Output:
`k6 run --insecure-skip-tls-verify -d 10s --rps 150 -u 1 http.js
WARN[0001] Request Failed error="Post "https://SNI-bot-mgmt-static-waf-policy-learning-8-148
-1-ch-0.botmgmttest.net:443/psm/POST/post1.php": dial tcp :443: connect: connection refused"
WARN[0001] Request Failed error="Post "https://SNI-bot-mgmt-static-waf-policy-learning-8-148
-1-ch-0.botmgmttest.net:443/psm/POST/post1.php": dial tcp :443: connect: connection refused"
WARN[0001] Request Failed error="Post "https://SNI-bot-mgmt-static-waf-policy-learning-8-148
-1-ch-0.botmgmttest.net:443/psm/POST/post1.php": dial tcp :443: connect: connection refused"
^C
✗ status is 200
↳ 0% — ✓ 0 / ✗ 146
✗ protocol is HTTP/1.1
↳ 0% — ✓ 0 / ✗ 146

 checks.....................: 0.00%   ✓ 0          ✗ 292
 data_received..............: 0 B     0 B/s
 data_sent..................: 0 B     0 B/s
 http_req_blocked...........: avg=0s     min=0s       med=0s     max=0s     p(90)=0s    p(95)=0s
 http_req_connecting........: avg=0s     min=0s       med=0s     max=0s     p(90)=0s    p(95)=0s
 http_req_duration..........: avg=0s     min=0s       med=0s     max=0s     p(90)=0s    p(95)=0s`
@joanlopez
Copy link
Contributor

Hi @srikr,

Thanks for reporting this issue. I'll be happy to try to reproduce it and work on a fix.

So, as your host looks like an internal one, could you bring details about that environment?
Do you use any specific version of TLS? Any other aspect to consider regarding TLS in that environment?
Have you been able to reproduce the same behavior with a publicly accessible site using TLS?

Thanks!

@srikr
Copy link
Author

srikr commented Mar 4, 2024

Hi @joanlopez,
That is our test machine which is configured for to run with only private IP. The TLS Version that it is using is version 1.2 based on PCAP of K6 Version 49 accessing using IP Address and not via Hostname. Also one more thing I observed is as follows:
If I access the server using IP with Latest version of K6 binary it is working but issue is happening only when accessing the Server via Hostname so I am not sure whether to suspect TLS here, checkout the below two Java Scripts(Working and Not Working)

Working JS for k6 version 49:
import http from "k6/http"; import { check } from "k6"; export var options = { hosts: { 'SNI-bot-mgmt-static-waf-policy-learning-4-148-1-ch-0.botmgmttest.net' : '172.16.28.88' } }; export default function() { var param = { headers: {'Accept': 'text/html'} }; check(http.get("https://172.16.28.88:443/psm/GET/get1.php?name1=aaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyz&department2=0123456789&address3=&pincode4=abcdefghijklstuvwxyz0123456789", param), { "status is 200": (r) => r.status == 200, "protocol is HTTP/1.1": (r) => r.proto == "HTTP/1.1", }); }

Non Working JS for k6 version 49:
import http from "k6/http"; import { check } from "k6"; export var options = { hosts: { 'SNI-bot-mgmt-static-waf-policy-learning-4-148-1-ch-0.botmgmttest.net' : '172.16.28.88' } }; export default function() { var param = { headers: {'Accept': 'text/html'} }; check(http.get("https://SNI-bot-mgmt-static-waf-policy-learning-4-148-1-ch-0.botmgmttest.net:443/psm/GET/get1.php?name1=aaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyzaaaaabbbbbaaaaacccccddddddeeeeeefffffgggghhhhhhiiiiiijjjjjjkkkkkkklmnopqrstuvwxyz&department2=0123456789&address3=&pincode4=abcdefghijklstuvwxyz0123456789", param), { "status is 200": (r) => r.status == 200, "protocol is HTTP/1.1": (r) => r.proto == "HTTP/1.1", }); }

Note: FYI Hostname SNI-bot-mgmt-static-waf-policy-learning-4-148-1-ch-0.botmgmttest.net is Pingable or Reachable from that VM

Attached is the PCAP Captured on Server when k6 sending traffic using via IP Address.
vs_virtualservice-7978349e-b254-49a0-b10c-b8f61106edec.1709521079.zip

I also tried to take a packet dump in the client when accessing via Hostname but capture doesn't contain any packets or K6 is not attempting to send packet out for some reason.

@srikr
Copy link
Author

srikr commented Mar 5, 2024

Any Update @joanlopez

@srikr
Copy link
Author

srikr commented Mar 6, 2024

Any Update please?

@srikr
Copy link
Author

srikr commented Mar 7, 2024

Any Help or Workaround is much appreciated @joanlopez

@srikr
Copy link
Author

srikr commented Mar 12, 2024

Any Update Please?

@joanlopez
Copy link
Contributor

Hey @srikr,

I didn't have time yet, but hopefully I'll have some along the week, so I'll try to update you by the end of the week.

@srikr
Copy link
Author

srikr commented Mar 12, 2024

Sure Thanks. We have release some time soon I want this async feature so that I can test things at scale using k6.

@srikr
Copy link
Author

srikr commented Mar 17, 2024

Any Update @joanlopez?

@joanlopez
Copy link
Contributor

joanlopez commented Mar 18, 2024

Hi @srikr,

Finally, I managed to have a look at your issue. It looks like a small bug when managing configured hosts (as in your case), and with casing. While we work on a fix to make this process more consistent, can you try it by defining your host in lower case?

Thanks!

@joanlopez
Copy link
Contributor

joanlopez commented Mar 18, 2024

Hey @srikr,

While I wait for you to confirm that the workaround above works for you, I've created the specific issue that explains what's the root cause and how to reproduce it (in a generic way): #3651, as well as the pull request to fix it: #3653.

The fix will most likely be shipped in v0.51.0 v0.50.0 (just on time for the next release), but anyway, hopefully the workaround lets you continue using the current version of k6 without issues. Please, confirm that it worked for you, so we can close this issue.

Thanks!

@joanlopez joanlopez removed the triage label Mar 18, 2024
@srikr
Copy link
Author

srikr commented Mar 18, 2024

Thanks @joanlopez for the workaround. Yes it is working fine. I will continue using this workaround until the next version is released. You can close the issue for now.

@joanlopez
Copy link
Contributor

Awesome, thanks for letting us know! Happy testing! 💟

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

No branches or pull requests

2 participants