Skip to content

ValidationService.getConstrainedProperties method has concurrent issue #31

@ghost

Description

When two thread run into this method at a same time, they all get closure

def validationClosure = validatableClass.constraints

The problem is two thread get same instance of closure. So when

validationClosure.setDelegate(constrainedPropertyBuilder)

is executed one by one, it may cause previous constrainedPropertyBuilder overwrited by later constrainedPropertyBuilder.

The worst result of this issue is application go into a loop and never break. Will take some times to explain why go int a loop, in short, it was some HashMap code.

change to below code should fix the issue:
def validationClosure = validatableClass.constraints.clone()

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