Skip to content

Extraneous log messages within validate function #180

@carolyn-lyra

Description

@carolyn-lyra

Description

We are integrating protovalidate for Protobuf validation in a Python service and noticing thousands of strange log messages coming from within validate(request).

Steps to Reproduce

We have the following in requirements.txt:
protovalidate==0.3.1

And in our middleware.py:

from protovalidate import validate, ValidationError
...
    try:
        parsed_request = ParseDict(json.loads(body), request_proto_class())
        validate(parsed_request)
    except ValidationError as validation_exc:
        logger.exception(validation_exc)
        raise HTTPException(status_code=422, detail=str(validation_exc.violations))

Expected Behavior

Validation function should not log extraneous messages.

Actual Behavior

Tens of thousands of log messages such as:

message:| | | | | | | | | | | | | | | | | | | | | | | | | | Tree('unary', [Tree('member', [Tree('member_dot', [Tree('member', [Tree('primary', [Tree('ident', [Token('IDENT', 'rules')])])]), Token('IDENT', 'lte')])])])",

coming from within the validate function.

Additionally, we're finding that the validate function hangs for > 10 seconds.

Screenshots/Logs

Environment

  • Operating System: Initially found the issue in one of our testing environments in Kubernetes, but the issue is reproducible on our local macOS machines.
  • Protobuf Compiler & Version: Buf 1.29.0
  • Protovalidate Version: 0.3.1

Possible Solution

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions