function-schemata code can be found at https://gerrit.wikimedia.org/g/mediawiki/services/function-schemata
ajv validators store errors on the validator function itself. Our wrapper code (javascript/src/schema.js; look for this task's ID) generates a ValidationStatus object more-or-less like this:
booleanResult = validateFunction( something); status = validationStatus( booleanResult, validateFunction.errors );
Conceivably, if the same validator were called twice simultaneously, validateFunction.errors could be overwritten before any status was generated:
Thread1: booleanResult = validateFunction( something ); Thread2: booleanResult = validateFunction( something ); Thread1: # tries to generate status with Thread2's errors!
Do something about this:
- we can allocate a new validator for each validation event (expensive)
- we can put a mutex inside the validateStatus code (JavaScript)