locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.11k stars 3k forks source link

FastHttpUser - Workers failed to send heartbeat, setting state to missing on the same machine. Working perfecly with HttpUser #2968

Open andreabisello opened 2 weeks ago

andreabisello commented 2 weeks ago

Prerequisites

Description

I'm on Windows 11 Python 3.11 everything full updated.

Everything working if used without master-workers.

Running as a master looks fine

(venv) PS C:\ec4a9867-4d56\qa-namirialarchive-testsuite\load_test> locust --master [2024-11-06 16:49:23,511] ACS-BISELLO/INFO/locust.main: Starting Locust 2.32.0 Error resolving address: [Errno 11001] getaddrinfo failed [2024-11-06 16:49:23,605] ACS-BISELLO/INFO/locust.main: Starting web interface at http://localhost:8089 (accepting connections from all network interfaces)

Running a worker in the same machine looks connecting to the master

(venv) PS C:\ec4a9867-4d56\qa-namirialarchive-testsuite\load_test> locust -f - --worker --master-host localhost [2024-11-06 16:50:37,280] ACS-BISELLO/INFO/locust.main: Starting Locust 2.32.0

Master recognize the worker

[2024-11-06 16:50:37,286] ACS-BISELLO/INFO/locust.runners: ACS-BISELLO_af4dace11361461ab2d0e182e220ab64 (index 0) reported as ready. 1 workers connected.

Starting test, asking to spawn 10 users

[2024-11-06 16:50:53,041] ACS-BISELLO/INFO/locust.runners: Sending spawn jobs of 10 users at 2.00 spawn rate to 1 ready workers [2024-11-06 16:50:58,086] ACS-BISELLO/INFO/locust.runners: Spawning is complete and report waittime is expired, but not all reports received from workers: {"PurchasingUser": 6} (6 total users)

after some seconds, workers looks not connected anymore

[2024-11-06 16:50:59,863] ACS-BISELLO/INFO/locust.runners: Worker ACS-BISELLO_af4dace11361461ab2d0e182e220ab64 failed to send heartbeat, setting state to missing. [2024-11-06 16:50:59,863] ACS-BISELLO/INFO/locust.runners: The last worker went missing, stopping test. [2024-11-06 16:51:03,926] ACS-BISELLO/INFO/locust.runners: Worker ACS-BISELLO_af4dace11361461ab2d0e182e220ab64 self-healed with heartbeat, setting state to running.

Restaring test, it looks it retry for a second, then go missing again and again.

if i simply replace FastHttpUser with HttpUser everything works like a charm.

(venv) PS C:\ec4a9867-4d56\qa-namirialarchive-testsuite\load_test> locust --master [2024-11-06 17:05:24,749] ACS-BISELLO/INFO/locust.main: Starting Locust 2.32.0 Error resolving address: [Errno 11001] getaddrinfo failed [2024-11-06 17:05:24,796] ACS-BISELLO/INFO/locust.main: Starting web interface at http://localhost:8089 (accepting connections from all network interfaces) [2024-11-06 17:05:30,445] ACS-BISELLO/INFO/locust.runners: ACS-BISELLO_6da8f258d75341cbb71c31e041cdfd77 (index 0) reported as ready. 1 workers connected. [2024-11-06 17:05:44,934] ACS-BISELLO/INFO/locust.runners: Sending spawn jobs of 10 users at 2.00 spawn rate to 1 ready workers [2024-11-06 17:05:49,101] ACS-BISELLO/INFO/locust.runners: All users spawned: {"PurchasingUser": 10} (10 total users)

Command line

locust --master

Locustfile contents

import random, json, base64
from locust import HttpUser, task, between, FastHttpUser, tag

class GitHubTest(FastHttpUser):
    host = "https://api.github.com"
    @task
    def get_user(self):
        self.client.get("https://locust.io/")

Python version

3.11

Locust version

2.32.0

Operating system

windows 11 full updated