You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are intermittently receiving the following error:
JSON::Schema::SchemaError:#012 The fragment '/definitions/<definition_name>' does not exist on schema file:<path/to/schema/file>.json#
The schema file has the definitions section in question, and it is being referenced appropriately ({ "$ref": "#/definitions/<definition_name>" }). The schema file contains a few external references, but I don't see how that would make a difference. I am aware of #229.
I have spent some time debugging and have not been able to discover the cause, nor am I able to reproduce the issue on my local machine -- this only happens in production. When I debugged it, I saw the definition was present in memory at the time of loading the schema. My best guess is some kind of memory issue or a race condition in the JSON Schema library itself which only happens at scale -- we currently see this a few times an hour, with no discernible pattern in timing, no apparent clustering of the issue, or anything else that would give me a clear picture of a possible cause.
We are calling it like so (modified to mask proprietary information):
classRequest# left out initialize and other irrelevant informationdefinvalid_fields# the entry pointreturn@invalid_fieldsif@invalid_fieldsreturn[]unlessrequest.post?return[]unlessjson_schema@raw_request_json=URI.decode_www_form(request.query_string).to_h.with_indifferent_access@invalid_fields=JSON::Validator.fully_validate(json_schema,raw_request_json)enddefjson_schemareturn@json_schemaif@json_schemareturn{}unlessFile.exist?(schema_filename)raw_schema_string=File.read(schema_filename)@json_schema=JSON.parse(raw_schema_string)@json_schemaenddefschema_filename@schema_filename ||= "lib/schemas/client1_schema.json"end
The text was updated successfully, but these errors were encountered:
AdrianTP
changed the title
Unpredictable failure to locate definitions section
Unpredictable Failure to Locate definitions Section at Runtime
Feb 5, 2019
We are intermittently receiving the following error:
JSON::Schema::SchemaError:#012 The fragment '/definitions/<definition_name>' does not exist on schema file:<path/to/schema/file>.json#
The schema file has the definitions section in question, and it is being referenced appropriately (
{ "$ref": "#/definitions/<definition_name>" }
). The schema file contains a few external references, but I don't see how that would make a difference. I am aware of #229.I have spent some time debugging and have not been able to discover the cause, nor am I able to reproduce the issue on my local machine -- this only happens in production. When I debugged it, I saw the definition was present in memory at the time of loading the schema. My best guess is some kind of memory issue or a race condition in the JSON Schema library itself which only happens at scale -- we currently see this a few times an hour, with no discernible pattern in timing, no apparent clustering of the issue, or anything else that would give me a clear picture of a possible cause.
Notes:
file:
for accessI am not comfortable posting the actual schema file here because it contains some proprietary information, but here's a pared-down example:
lib/schemas/client1_schema.json
(modified to mask proprietary information):lib/schemas/common/identifier.json
(modified to mask proprietary information):We are calling it like so (modified to mask proprietary information):
The text was updated successfully, but these errors were encountered: