Skip to content

Be selective about data included in warnings #50

@vfazio

Description

@vfazio

If a request comes in for a task that does not exist, the string representation of the class gets dumped to the warning. If the request was to stream a binary file, then logs can be flooded with a lot of useless data:

https://github.com/uSpike/rpcx/blob/main/src/rpcx/server.py#L202

#033[33mWARNING #033[0m rpcx.server@68 #033[33mRequested non-existing task: RequestStreamChunk(id=4, value=b'MZ\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00PE\x00\x00d\x86\x04
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x00" \x0b\x02\x08\x00\x00\xf6F\x00`S\x02\x00\x00\x00\x00\x00\xe0j\t
\x00\x80\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\xe0KI\x00\x80\x02\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00`0I\x00p\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00.text\x00\x00\x00\xf0\xf5F\x00\x80\x02\x00\x00\x00\xf6F\x00\x80\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00 \x00\x00h\x00\x00\x00\x00\x00\x00\x00\x00\x84\x02\x01\x00\x80\xf8F\x00\xa0\x02\x01\x00\x80\xf8F\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00B.xdata\x00\x00$5\x01\x00 \xfbG\x00@5\x01\x00 \xfbG\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00@\x00\x00B.reloc\x00\x00p\x1b\x00\x00`0I\x00\x80\x1b\x00\x00`0I\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00@\x00\x00B\x00\x00\x00\x00\x00\x00\x00\x00\x83\x15\x84\x15\x85\x15\x00\x00\x00\x08\x0

We could either truncate the data being logged or log some summary of the data. I can see where having the first few bytes may be useful for short messages back and forth or as an indication of binary data being sent (like the first few bytes of a PE being transferred), but not sure where the useful limit is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions