Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/rpc_receive…
Browse files Browse the repository at this point in the history
…_error
  • Loading branch information
marcinh committed Dec 7, 2022
2 parents 79889a5 + 54a0d1c commit 6033965
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 15 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# Detailed changelog
The most important changes can also be found in [the documentation](https://docs.locust.io/en/latest/changelog.html).

## [2.13.1](https://github.com/locustio/locust/tree/2.13.1) (2022-12-01)

[Full Changelog](https://github.com/locustio/locust/compare/2.13.1...2.13.1)

**Closed issues:**

- UnboundLocalError after receiving ZMQ corrupted message [\#2260](https://github.com/locustio/locust/issues/2260)

## [2.13.1](https://github.com/locustio/locust/tree/2.13.1) (2022-12-01)

[Full Changelog](https://github.com/locustio/locust/compare/2.13.0...2.13.1)

**Fixed bugs:**

- locust.io is down [\#2265](https://github.com/locustio/locust/issues/2265)
- locust 2.13.0 failed to run [\#2263](https://github.com/locustio/locust/issues/2263)
- Issue installing on M1 Mac [\#2249](https://github.com/locustio/locust/issues/2249)
- 'Namespace' object has no attribute 'stop\_timeout' in version 2.13.0 [\#2243](https://github.com/locustio/locust/issues/2243)

**Closed issues:**

- locust test flask application [\#2255](https://github.com/locustio/locust/issues/2255)

**Merged pull requests:**

- Dont reset connection to worker if master receives a corrupted zmq message [\#2266](https://github.com/locustio/locust/pull/2266) ([marcinh](https://github.com/marcinh))
- auto generated locustfiles from browser recordings using har2locust \(documentation\) [\#2259](https://github.com/locustio/locust/pull/2259) ([cyberw](https://github.com/cyberw))
- Small fixes to documentation [\#2254](https://github.com/locustio/locust/pull/2254) ([jscanlannyc](https://github.com/jscanlannyc))
- Added a better working docker command for Windows users [\#2248](https://github.com/locustio/locust/pull/2248) ([MagnusNordboe](https://github.com/MagnusNordboe))
- Update documentation for Environment.parsed\_options [\#2247](https://github.com/locustio/locust/pull/2247) ([klazuka](https://github.com/klazuka))
- Use C-style \(percent\) string formatting for all debug logging statements \(improves performance\) [\#2245](https://github.com/locustio/locust/pull/2245) ([cyberw](https://github.com/cyberw))
- Replace datetime.utcnow\(\) with datetime.now\(tz=timezone.utc\), as it is kind of an antipattern [\#2244](https://github.com/locustio/locust/pull/2244) ([cyberw](https://github.com/cyberw))
- Tiny performance enhancements [\#2240](https://github.com/locustio/locust/pull/2240) ([cyberw](https://github.com/cyberw))

## [2.13.0](https://github.com/locustio/locust/tree/2.13.0) (2022-10-28)

[Full Changelog](https://github.com/locustio/locust/compare/2.12.2...2.13.0)
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog Highlights

For full details of the Locust changelog, please see https://github.com/locustio/locust/blob/master/CHANGELOG.md

2.13.1
======
* Document har2locust (auto generation of locustfiles from browser recordings) by @cyberw in https://github.com/locustio/locust/pull/2259
* Dont reset connection to worker if master receives a corrupted zmq message by @marcinh in https://github.com/locustio/locust/pull/2266
* Other minor fixes

2.13.0
======
* Add the ability to set default_headers on FastHttpUser by @cyberw in https://github.com/locustio/locust/pull/2231
Expand Down
6 changes: 6 additions & 0 deletions docs/extending-locust.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ Context from User instance::
print(context["username"])


Context from a value in the response, using :ref:`catch_response <catch-response>`::

with self.client.get("/", catch_response=True) as resp:
resp.request_meta["context"]["requestId"] = resp.json()["requestId"]


Adding Web Routes
==================

Expand Down
6 changes: 6 additions & 0 deletions docs/writing-a-locustfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@ If you want to chain multiple groupings with minimal boilerplate, you can use th
for i in range(10):
self.client.get("/article?id=%i" % i)
Using :ref:`catch_response <catch-response>` and accessing `request_meta <https://github.com/locustio/locust/blob/master/locust/clients.py#L145>`_ directly, you can even rename requests based on something in the response.

.. code-block:: python
with self.client.get("/", catch_response=True) as resp:
resp.request_meta["name"] = resp.json()["name"]
HTTP Proxy settings
Expand Down
2 changes: 1 addition & 1 deletion generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"-p",
"locust",
"--exclude-labels",
"duplicate,question,invalid,wontfix,cantfix,stale",
"duplicate,question,invalid,wontfix,cantfix,stale,no-changelog",
"--header-label",
"# Detailed changelog\nThe most important changes can also be found in [the documentation](https://docs.locust.io/en/latest/changelog.html).",
"--since-tag",
Expand Down
11 changes: 3 additions & 8 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,14 +988,9 @@ def client_listener(self) -> NoReturn:
try:
client_id, msg = self.server.recv_from_client()
except RPCReceiveError as e:
logger.error(f"RPCError when receiving from client: {e}. Will reset client {client_id}.")
try:
self.server.send_to_client(Message("reconnect", None, client_id))
except Exception as e:
logger.error(f"Error sending reconnect message to worker: {e}. Will reset RPC server.")
self.connection_broken = True
gevent.sleep(FALLBACK_INTERVAL)
continue
# TODO: Add proper reconnect if https://github.com/zeromq/pyzmq/issues/1809 fixed
logger.error(f"Unrecognized message detected: {e}")
continue
except RPCSendError as e:
logger.error(f"Error sending reconnect message to worker: {e}. Will reset RPC server.")
self.connection_broken = True
Expand Down
7 changes: 1 addition & 6 deletions locust/test/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -3040,12 +3040,7 @@ def my_task(self):
master.start(10, 10)
sleep(0.1)
server.mocked_send(Message("stats", BAD_MESSAGE, "zeh_fake_client1"))
self.assertEqual(4, len(server.outbox))

# Expected message order in outbox: ack, spawn, reconnect, ack
self.assertEqual(
"reconnect", server.outbox[2][1].type, "Master didn't send worker reconnect message when expected."
)
self.assertEqual(2, len(server.outbox))


class TestWorkerRunner(LocustTestCase):
Expand Down

0 comments on commit 6033965

Please sign in to comment.