myzhan / locust4j

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

Error while receiving a message #44

Closed Neyzoter closed 1 month ago

Neyzoter commented 3 months ago

I have used several locust versions(2.0, 2.2, 2.16, 2.20) to control locust4j workers, but exceptions always occured.And witch locust version do you recomand to use?

2024-05-17 17:18:19 ERROR Runner:415 - Error while receiving a message
java.lang.IllegalArgumentException
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1237)
        at com.github.myzhan.locust4j.runtime.Runner.startSpawning(Runner.java:202)
        at com.github.myzhan.locust4j.runtime.Runner.onSpawnMessage(Runner.java:291)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:336)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:413)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
2024-05-17 17:19:43 ERROR Runner:415 - Error while receiving a message
java.lang.NullPointerException
        at com.github.myzhan.locust4j.runtime.Runner.shutdownThreadPool(Runner.java:244)
        at com.github.myzhan.locust4j.runtime.Runner.stop(Runner.java:254)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:339)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:413)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
myzhan commented 3 months ago

You should always use the latest version of locust and locust4j. And how to reproduce this issue?

Neyzoter commented 3 months ago

You should always use the latest version of locust and locust4j. And how to reproduce this issue?

  1. Run 10 workers.
  2. Start one runner.
  3. Inc to 10 runners.
  4. The workers throw these exceptions.
myzhan commented 3 months ago

Looks like locust send invalid number of users. Can you add some logs to debug?

Neyzoter commented 3 months ago

@myzhan please help check the below messages from mater.

2024-06-01 14:34:32 INFO  Worker:68 - Connected to: jdbc:clickhouse:http://cc-uf67hwqx1uq0ior0u-clickhouse.clickhouseserver.rds.aliyuncs.com:8123
2024-06-01 14:34:53 INFO  Runner:291 - Recv spawn message from master: iZuf6aj1fhxxxxxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=0}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722368E9}, numUsers: 0
2024-06-01 14:34:53 ERROR Runner:417 - Error while receiving a message
java.lang.IllegalArgumentException
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1237)
        at com.github.myzhan.locust4j.runtime.Runner.startSpawning(Runner.java:202)
        at com.github.myzhan.locust4j.runtime.Runner.onSpawnMessage(Runner.java:293)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:319)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:415)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
2024-06-01 14:35:45 INFO  Runner:291 - Recv spawn message from master: iZuf6ajxxxxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=0}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722381E9}, numUsers: 0
2024-06-01 14:35:45 ERROR Runner:417 - Error while receiving a message
java.lang.IllegalArgumentException
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1237)
        at com.github.myzhan.locust4j.runtime.Runner.startSpawning(Runner.java:202)
        at com.github.myzhan.locust4j.runtime.Runner.onSpawnMessage(Runner.java:293)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:338)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:415)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
2024-06-01 14:35:46 INFO  Runner:291 - Recv spawn message from master: iZuf6aj1xxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=1}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722381E9}, numUsers: 1
Neyzoter commented 3 months ago

@myzhan please help check the below messages from mater.

2024-06-01 14:34:32 INFO  Worker:68 - Connected to: jdbc:clickhouse:http://cc-uf67hwqx1uq0ior0u-clickhouse.clickhouseserver.rds.aliyuncs.com:8123
2024-06-01 14:34:53 INFO  Runner:291 - Recv spawn message from master: iZuf6aj1fhxxxxxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=0}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722368E9}, numUsers: 0
2024-06-01 14:34:53 ERROR Runner:417 - Error while receiving a message
java.lang.IllegalArgumentException
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1237)
        at com.github.myzhan.locust4j.runtime.Runner.startSpawning(Runner.java:202)
        at com.github.myzhan.locust4j.runtime.Runner.onSpawnMessage(Runner.java:293)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:319)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:415)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
2024-06-01 14:35:45 INFO  Runner:291 - Recv spawn message from master: iZuf6ajxxxxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=0}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722381E9}, numUsers: 0
2024-06-01 14:35:45 ERROR Runner:417 - Error while receiving a message
java.lang.IllegalArgumentException
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1314)
        at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1237)
        at com.github.myzhan.locust4j.runtime.Runner.startSpawning(Runner.java:202)
        at com.github.myzhan.locust4j.runtime.Runner.onSpawnMessage(Runner.java:293)
        at com.github.myzhan.locust4j.runtime.Runner.onMessage(Runner.java:338)
        at com.github.myzhan.locust4j.runtime.Runner.access$600(Runner.java:28)
        at com.github.myzhan.locust4j.runtime.Runner$Receiver.run(Runner.java:415)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
2024-06-01 14:35:46 INFO  Runner:291 - Recv spawn message from master: iZuf6aj1xxxxxxZ_67018b30fe654430a5e9c9d6cf5f4bdd-spawn-{user_classes_count={Dummy=1}, host=, parsed_options={print_stats=false, html_file=null, tls_key=, stats_history_enabled=false, autostart=false, num_users=null, web_host=, locustfile=dummy.py, web_auth=null, host=null, csv_prefix=null, worker=false, run_time=null, master_host=127.0.0.1, logfile=null, web_port=8089, tls_cert=, list_commands=false, tags=null, autoquit=-1, master_bind_host=*, modern_ui=false, enable_rebalancing=false, hatch_rate=0, show_task_ratio=false, equal_weights=false, expect_workers_max_wait=0, exit_code_on_error=1, spawn_rate=null, slave=false, stop_timeout=0, skip_log_setup=false, class_picker=false, json=false, master_bind_port=5557, processes=null, user_classes=[], only_summary=false, expect_slaves=false, exclude_tags=null, master=true, headless=false, expect_workers=1, reset_stats=false, loglevel=INFO, show_task_ratio_json=false, master_port=5557, headful=false, config=null}, stop_timeout=0.0, timestamp=1.71722381E9}, numUsers: 1

user_classes_count={Dummy=0} seem like a problem.

Neyzoter commented 3 months ago

I created a pr, can you review it? @myzhan

45 https://github.com/myzhan/locust4j/pull/45

bradj121 commented 1 month ago

@myzhan Is it possible to publish a new version of locust4j with this change? The latest 2.2.3 doesn't have it. Thanks!

myzhan commented 1 month ago

@myzhan Is it possible to publish a new version of locust4j with this change? The latest 2.2.3 doesn't have it. Thanks!

OK