NUAAwqy opened a new issue, #1497: URL: https://github.com/apache/rocketmq-clients/issues/1497
Verified against `master` (python/rocketmq/v5) by executing the module directly, cross-checked against the Java reference implementation (`java/client`), every item reproduced offline: 1. **`RetryPolicy.get_next_attempt_delay` accepts attempt=0** — the guard is `attempt < 0` in both `CustomizedBackoffRetryPolicy` and `ExponentialBackoffRetryPolicy`, while the docstring (and Java's `checkArgument(attempt > 0)`) call for a 1-based positive attempt. With `attempt=0` the customized policy returns the longest backoff (`durations[-1]`) and the exponential policy returns 0.5. 2. **Fractional seconds crash protobuf int64 fields** — `ExponentialBackoffRetryPolicy` returns fractional seconds (float), but `consumer.py` assigns it straight into `req.invisible_duration.seconds` (int64): `TypeError: 'float' object cannot be interpreted as an integer` on the nack path of a server-driven exponential policy, and on user-supplied float durations for `SimpleConsumer.receive`/`change_invisible_duration`. Sub-second precision is dropped instead of flowing into the `nanos` field. 3. **Missing `delivery_attempt` makes a failed push-consumer message unrecoverable** — `push_consumer.py` reads `message.delivery_attempt` which is `None` when the proxy did not populate it; `get_next_attempt_delay(None)` raises `TypeError`, which the generic `except` in `__ack_or_nack` swallows and retries forever with **zero RPCs**; the message is never evicted and the FIFO consumption queue blocks permanently. 4. **nack retry loop is unbounded recursion** — `__execute_ack_or_nack_later` recurses on every nack failure; with a persistently failing endpoint this crashes the consumption thread with `RecursionError`. 5. **Server-driven exponential backoff is silently ignored by the push consumer** — `PushConsumerSettings` replaces the policy with `CustomizedBackoffRetryPolicy(None)` unless `use_customized_backoff` is set, ignoring the server's exponential policy (Java `PushSubscriptionSettings` honors both). Relatedly, `RetryPolicy.__eq__` raises `AttributeError` when compared across policy types instead of returning `NotImplemented`. 6. **`initial_backoff=0` is treated as unconfigured** — `if self.__initial_backoff and ...` falls back to 1s when a legitimate "retry immediately" (Java `immediatelyRetryPolicy`) configures 0. 7. **Producer send retries have no backoff delay** — docstring claims "3 attempts with exponential backoff", but the three attempts fire back-to-back; Java `ProducerImpl` schedules the next attempt at `getNextAttemptDelay`. 8. **`TooManyRequestsException` aborts retries entirely** — Java treats throttled requests as retriable with backoff; the Python client re-raises immediately. 9. **DLQ delivery also crashes on missing `delivery_attempt`** — `req.delivery_attempt = message.delivery_attempt` with `None` → `TypeError` on int32. This PR fixes all nine with unit tests (30 new offline tests, existing 8 pass unchanged) and aligns behavior with the Java reference implementation where the semantics were ambiguous. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
