myzhan / locust4j

Locust4j is a load generator for locust, written in Java.
MIT License
81 stars 30 forks source link

Exception throws on attempt to report request results to maste #16

Closed eduardrudko closed 4 years ago

eduardrudko commented 4 years ago

Hi all, i'm currently trying to use locust with java client in distributed mode. I have wrote a simple custom task that sends GET request to version. The approach i'm using described here: https://www.blazemeter.com/blog/locust-performance-testing-using-java-and-kotlin/ So problem i'm struggling with is that when the following line is executed: Locust.getInstance().recordSuccess(String requestType, String name, long responseTime, long contentLength); or Locust.getInstance().recordFailure(String requestType, String name, long responseTime, String error

The Locust master node throwing an exception and states the following: [2020-03-20 07:59:40,262] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s

I'm running locust in docker and i've tried different versions of Python and Locust master. The most stable combination i've found is Python 3.6 + Locustio 0.11.0

Here is the full log: docker run -ti -p 5557:5557 -p 8089:8089 locust [2020-03-20 07:46:10,978] 5e94371d5d92/INFO/locust.main: Starting web monitor at *:8089 [2020-03-20 07:46:10,991] 5e94371d5d92/INFO/locust.main: Starting Locust 0.11.0 [2020-03-20 07:59:22,425] 5e94371d5d92/INFO/locust.runners: Client 'macbook0258_226e0d2986be793d6ac910f36f141a4c' reported as ready. Currently 1 clients ready to swarm. [2020-03-20 07:59:37,413] 5e94371d5d92/INFO/locust.runners: Sending hatch jobs to 1 ready clients [2020-03-20 07:59:40,262] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:43,269] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:46,272] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:49,281] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:52,254] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:55,261] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s [2020-03-20 07:59:58,267] 5e94371d5d92/INFO/locust.util.exception_handler: Exception found on retry 1: -- retry after 1s

Expected behavior The request results should have been recorded and displayed on UI

Actual behavior The request results have not been recorded and exception thrown.

Steps to reproduce Implement simple custom task using the instructions described https://www.blazemeter.com/blog/locust-performance-testing-using-java-and-kotlin/ In custom task send some simple request and record results Setup Locust master and run the following command : locust -f locust-master.py --master --master-bind-host=127.0.0.1 --master-bind-port=5557 Check heartbeat on Locust masters output Goto UI and run performance. Environment OS: macOS Mojave : 10.14.6 Python version: python:3.6.8 Locust version: 0.11.0 Locust command line that you ran: locust -f /locust-master.py --master --master-bind-host=0.0.0.0 --master-bind-port=5557 Locust file contents (anonymized if necessary): from locust import Locust, TaskSet, task class DummyTask(TaskSet): @task(1) def dummy(self): pass class Dummy(Locust): task_set = DummyTask Using locust4j lib https://github.com/myzhan/locust4j - 1.0.8

P.S. I've tried different approaches, local run, docker, different Python versions, Locust versions, Locust4j versions and OS types, Including Windows 10 and have no ideas anymore whats wrong.

myzhan commented 4 years ago

You can use locust4j 1.0.9, to work the latest locust master. Because locust changed the data protocol.

eduardrudko commented 4 years ago

Hi @myzhan thank you for your response. The exception throws even on 1.0.9 locust4f version. Any ideas what else could be the problem?

myzhan commented 4 years ago

Try to modify the local copy of exception_handler.py, and use traceback to print out the stack.

eduardrudko commented 4 years ago

Fixed by using the docker image https://hub.docker.com/r/swernst/locusts and version of locust 0.11.0