brookshi / Hitchhiker-Node

Stress test node for Hitchhiker
GNU General Public License v2.0
19 stars 19 forks source link

Deploy stress module on Mac, get error #1

Closed ansonliao closed 6 years ago

ansonliao commented 6 years ago

Deploying the stress module on Mac, get websocket error, please check the log below.

$: ./Hitchhiker-Node_darwin_amd64
info: 2017/10/17 16:34:47 main.go:12: set max procs:  8
info: 2017/10/17 16:34:47 client.go:51: read config
info: 2017/10/17 16:34:47 client.go:66: connect: success
info: 2017/10/17 16:34:47 client.go:120: send request run result 0
info: 2017/10/17 16:34:47 client.go:68: status: idle
error: 2017/10/17 16:34:47 client.go:83: read: EOF
info: 2017/10/17 16:34:57 client.go:73: retry
info: 2017/10/17 16:34:57 client.go:66: connect: success
info: 2017/10/17 16:34:57 client.go:120: send request run result 0
info: 2017/10/17 16:34:57 client.go:68: status: idle
error: 2017/10/17 16:34:57 client.go:83: read: EOF
info: 2017/10/17 16:35:07 client.go:73: retry
info: 2017/10/17 16:35:07 client.go:66: connect: success
info: 2017/10/17 16:35:07 client.go:120: send request run result 0
info: 2017/10/17 16:35:07 client.go:68: status: idle
error: 2017/10/17 16:35:07 client.go:83: read: EOF

please advise how to fix it?

Thanks.

brookshi commented 6 years ago

It seem stress module cannot read data from server, I will try it in Mac.

brookshi commented 6 years ago

hi, I build a new file to handle EOF, could you help to try this file below: Hitchhiker-Node_darwin_amd64.zip

brookshi commented 6 years ago

I try it on my Mac and can't reproduce it.

info: 2017/10/17 22:31:39 main.go:12: set max procs:  4
info: 2017/10/17 22:31:39 client.go:52: read config
info: 2017/10/17 22:31:39 client.go:67: connect: success
info: 2017/10/17 22:31:39 client.go:125: send request run result 0
info: 2017/10/17 22:31:39 client.go:69: status: idle
info: 2017/10/17 22:32:19 client.go:93: read:  {"status":0,"type":1,"testCase":{"requestBodyList":[{"id":"f23c56a0-b347-11e7-b196-8d10e80df3a1-rJfpwN5ma-","param":"","method":"DELETE","url":"http://{{apihost}}/sample/001","body":"{\n\t\"id\": \"002\",\n\t\"name\": \"sample 3\"\n}","headers":{"Content-Type":"application/json"},"test":"\ntests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"request is success\"] = responseObj.success;\n\ntests[\"Response time is less than 500ms\"] = responseTime \u003c 500;"},{"id":"f23c56a2-b347-11e7-b196-8d10e80df3a1-B1EpwE9Qpb","param":"","method":"GET","url":"http://{{apihost}}/sample/001","body":"","headers":{"Content-Type":"application/json"},"test":"\ntests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"request is success\"] = responseObj.success;\n\ntests[\"id is correct\"] = responseObj.result.id === \"001\";"},{"id":"f23c56a4-b347-11e7-b196-8d10e80df3a1-HkITvVcm6-","param":"","method":"POST","url":"http://{{apihost}}/sample","body":"{\n\t\"id\": \"002\",\n\t\"name\": \"sample 2\"\n}","headers":{"Content-Type":"application/json"},"test":"\ntests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"request is success\"] = responseObj.success;\n\ntests[\"id is correct\"] = responseObj.result.id === \"002\";"},{"id":"f23c56a6-b347-11e7-b196-8d10e80df3a1-B1OawNcm6W","param":"","method":"PUT","url":"http://{{apihost}}/sample","body":"{\n\t\"id\": \"002\",\n\t\"name\": \"sample 3\"\n}","headers":{"Content-Type":"application/json"},"test":"\ntests[\"Status code is 200\"] = responseCode.code === 200;\n\ntests[\"request is success\"] = responseObj.success;\n\ntests[\"name is update success\"] = responseObj.result.name === \"sample 3\";"}],"envVariables":{"apihost":"www.hitchhiker-api.com/api"},"repeat":1,"concurrencyCount":10,"qps":0,"timeout":0,"keepAlive":true},"runResult":{"id":"","success":false,"param":"","error":{"message":""},"body":"","status":0,"statusMessage":"","duration":{"dns":0,"connect":0,"request":0},"headers":null,"tests":null},"cpuNum":0}
info: 2017/10/17 22:32:19 client.go:125: send request run result 5
info: 2017/10/17 22:32:19 client.go:108: status: ready
info: 2017/10/17 22:32:19 client.go:93: read:  {"status":0,"type":2,"testCase":{"requestBodyList":null,"envVariables":null,"repeat":0,"concurrencyCount":0,"qps":0,"timeout":0,"keepAlive":false},"runResult":{"id":"","success":false,"param":"","error":{"message":""},"body":"","status":0,"statusMessage":"","duration":{"dns":0,"connect":0,"request":0},"headers":null,"tests":null},"cpuNum":0}
info: 2017/10/17 22:32:19 client.go:110: status: start
info: 2017/10/17 22:32:19 client.go:125: send request run result 5
info: 2017/10/17 22:32:19 js_interpreter.go:74: Response time is less than 500ms true
info: 2017/10/17 22:32:19 js_interpreter.go:74: Status code is 200 true
info: 2017/10/17 22:32:19 js_interpreter.go:74: request is success true
ansonliao commented 6 years ago

Hi @brookshi will try the build from you. thanks for your following.

ansonliao commented 6 years ago

@brookshi still get some errors from your build

./Hitchhiker-Node_darwin_amd64 
Password:
info: 2017/10/18 10:01:10 main.go:12: set max procs:  8
info: 2017/10/18 10:01:10 client.go:52: read config
info: 2017/10/18 10:01:10 client.go:67: connect: success
info: 2017/10/18 10:01:10 client.go:125: send request run result 0
info: 2017/10/18 10:01:10 client.go:69: status: idle
info: 2017/10/18 10:01:10 client.go:84: read EOF, sleep 1 sec
info: 2017/10/18 10:01:11 client.go:84: read EOF, sleep 1 sec
error: 2017/10/18 10:01:12 client.go:87: read: invalid character 'd' looking for beginning of value
info: 2017/10/18 10:01:20 client.go:74: retry
info: 2017/10/18 10:01:20 client.go:67: connect: success
info: 2017/10/18 10:01:20 client.go:125: send request run result 0
info: 2017/10/18 10:01:20 client.go:69: status: idle
info: 2017/10/18 10:01:20 client.go:84: read EOF, sleep 1 sec
info: 2017/10/18 10:01:21 client.go:84: read EOF, sleep 1 sec
error: 2017/10/18 10:01:22 client.go:87: read: invalid character 'd' looking for beginning of value

what the command to run the program? I only changed the config.json, and then run the program by ./, even run the program by sudo, also get errors.

please advise.

brookshi commented 6 years ago

Use ./Hitchhiker-Node_darwin_amd64 is right. Could you show the change of config.json, I want to know the port stress module listen

ansonliao commented 6 years ago

@brookshi Hitchhiker run by Docker, and Hitchhiker config change the IP same as the stress module's config address setting.

config.json

{
    "Address": "10.1.76.67:1234",
    "Interval": 10
}
brookshi commented 6 years ago

Hitchhiker default use port:11010 for stress, if you want to change port, you also need change stressPort in appconfig.json. you can try 11010 at first

ansonliao commented 6 years ago

Sorry, I can't get your instruction exactly.

My Hitchhiker ip set to 10.1.76.67, and port set to 1234, so my Hitchhiker link is 10.1.76.67:1234.

for stress module, IP should be set to 10.1.76.67, no question on it, for the port setup of stress module, should be my Hitchhiker's port 1234 or stress module default port you mention 11010?

so stress module address should be 10.1.76.67:1234 or 10.1.76.67:11010 ?

Thanks.

brookshi commented 6 years ago

In general, Hitchhiker listen two ports, one for web app and another for stress module, so I think your 1234 is for web app, stress module should use its default port 11010.

ansonliao commented 6 years ago

@brookshi Yes, port 1234 is for browser to open the Hitchhiker site. Just now, I changed stress module port to 11010, but also get connection refuse error message.

attached my Hitchhiker config and stress module config.

error msg

$: ./Hitchhiker-Node_darwin_amd64
info: 2017/10/18 11:10:44 main.go:12: set max procs:  8
info: 2017/10/18 11:10:44 client.go:52: read config
error: 2017/10/18 11:10:44 client.go:64: connect: websocket.Dial ws://10.1.76.67:11010: dial tcp 10.1.76.67:11010: getsockopt: connection refused
info: 2017/10/18 11:10:54 client.go:74: retry
error: 2017/10/18 11:10:54 client.go:64: connect: websocket.Dial ws://10.1.76.67:11010: dial tcp 10.1.76.67:11010: getsockopt: connection refused
info: 2017/10/18 11:11:04 client.go:74: retry
error: 2017/10/18 11:11:04 client.go:64: connect: websocket.Dial ws://10.1.76.67:11010: dial tcp 10.1.76.67:11010: getsockopt: connection refused
info: 2017/10/18 11:11:14 client.go:74: retry

Hitchhiker config in docker-compose.yml

hitchhiker:
    image: brookshi/hitchhiker:v0.2
    container_name: hitchhiker
    environment:
      - HITCHHIKER_DB_HOST=hitchhiker-mysql
      - HITCHHIKER_APP_HOST=http://10.1.76.67:1234/ # should change in run time.
    ports:
      - "1234:8080"

stress module config

{
    "Address": "10.1.76.67:11010",
    "Interval": 10
}

and found that no mention port 11010 in Hitchhiker config.

brookshi commented 6 years ago

It's an old docker-compose.yml? I update it for this release. you can get it https://github.com/brookshi/Hitchhiker/blob/release/deploy/docker/hitchhiker_and_mysql/docker-compose.yml

ansonliao commented 6 years ago

@brookshi I c, I used the old docker-compose.yml file, I thought only update Hitchhiker docker to latest is OK.

Just tried again, and works fine now.

thanks.