Skip to content

close() on a full queue drops the oldest report without logging or documenting it #42

Closed

Description

@dmccoystephenson

When close() is called on a full queue, the oldest queued report is removed to make room for the stop sentinel (trace_client/trace_client.py, the except queue.Full: branch in close(), which calls q.get_nowait()). That report is discarded silently:

  • Nothing is logged. Every other drop is logged at DEBUG on the trace logger (report() logs [trace] queue full, dropped <name>; _send logs undelivered bodies), and the README's "What report promises" table says drops are "logged at DEBUG on the trace logger, otherwise not at all".
  • Neither the README's "close() drains" row nor the close() docstring mentions the drop. Both say reports already queued get up to the timeout to be sent, and the README says reports still queued at the timeout "are not discarded". On a full queue, one of them is.

The behaviour itself is covered by test_close_on_a_full_queue_drops_the_oldest_report_and_still_stops_the_sender, and the reason for it is sound (without the drop, the sender thread would never stop). What is missing is the log line and the documentation.

Suggested fix: log the displaced report at DEBUG with the [trace] prefix, and state the full-queue drop in the close() docstring and the README row. Neither the wire format nor the opt-out semantics change.

This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions