godaddy / datastar

A robust and feature rich ODM for Cassandra.
MIT License
40 stars 12 forks source link

[bugfix] Fix recursive loop possible in denull logic #27

Closed scommisso closed 5 years ago

scommisso commented 5 years ago

Prevent the following error introduced in 1.3.1 for some consumers: {"error":{"stack":"RangeError: Maximum call stack size exceeded\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:714:41)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)\n at Schema.valueToNull (/src/node_modules/datastar/lib/schema.js:739:31)"}}

samshull commented 5 years ago

Can you add a test case for this, please?

scommisso commented 5 years ago

Can you add a test case for this, please?

Yeah, I'll give it a shot. I can't really figure it out because the Schema doesn't support a recursive object (since it hydrates from JSON). I really have no clue how clients are triggering this at the moment.