-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Pardon the sparse issue, I've been scratching my head looking at this for a bit now, and have been unable to replicate it outside of our company's repo. The repo is Clojure-only, and we are on malli v0.20.
I've been speaking to @opqdonut about this in the Clojure slack over the last couple days.
We have 27 function-schemas across our repo, and maybe around 60 schemas of varying complexity (nothing breaking more than 34 lines (mostly map-schemas with little nesting) from my current measure).
I've been experiencing a StackOverflow, from the malli.core/register-function-schema function, when I do one of the following with malli dev-mode active:
- execute
cider-ns-reload-allon a file containing a function schema definition(malli.core/=> ...)(of any complexity) - execute
(malli.dev/start!)after an exception has already occurred from the command above - execute
(malli.instrument/instrument!)(in some circumstance which I forget how to replicate atm)
This StackOverflow stops happening, and will not happen again until I start a new REPL, when I do one of the following:
- execute
(malli.core/-deregister-function-schemas! :clj) - instrument the
malli.corenamespace with the FlowStorm debugger (I believe this re-evals the malli namespaces, so perhaps thats why, it may be indirectly doing the same thing as the-deregister-...) - *turn off dev-mode (this does cause the error to happen upon
start!ing it again, however)
After the overflow occurs, calls to (malli.core/function-schemas :clj) return an illegal-argument exception, with the message: No implementation of method: :-form of protocol: #'malli.core/Schema found for class: malli.core$__EQ__GT$reify$reify__40157
This reify appears in the stack traces quite a bit, I'm not sure where it might be connected responsibility-wise, but it seems to get called ~7k times when this error occurs. I've seen malli.registry/composite-registry also called a significant amount of times during error.
When instrumenting malli.* namespaces from the beginning and stepping through with FlowStorm, I did notice a lot of flipping between a -vmap function and a check-children! function, which seemed to be failing? Stepping through has not revealed a clear cause among schemas or namespaces yet (credit to its name, the stack overflow does indeed contain quite a bit of executed code).
Here is a snippet of the overflow:
#error {
:cause nil
:via
[{:type java.lang.StackOverflowError
:message nil
:at [malli.core$_lookup invokeStatic "core.cljc" 320]}]
:trace
[[malli.core$_lookup invokeStatic "core.cljc" 320]
[malli.core$_lookup invoke "core.cljc" 320]
[malli.core$_lookup_BANG_ invokeStatic "core.cljc" 331]
[malli.core$_lookup_BANG_ invoke "core.cljc" 329]
[malli.core$schema invokeStatic "core.cljc" 2553]
[malli.core$schema invoke "core.cljc" 2531]
[malli.core$_schema_schema$reify__447771$fn__447772 invoke "core.cljc" 2045]
[malli.impl.util$_vmap invokeStatic "util.cljc" 28]
[malli.impl.util$_vmap invoke "util.cljc" 23]
[malli.core$_vmap invokeStatic "core.cljc" 266]
[malli.core$_vmap invoke "core.cljc" 266]
[malli.core$_schema_schema$reify__447771 _into_schema "core.cljc" 2045]
[malli.core$_lookup invokeStatic "core.cljc" 327]
[malli.core$_lookup invoke "core.cljc" 320]
[malli.core$_lookup_BANG_ invokeStatic "core.cljc" 331]
[malli.core$_lookup_BANG_ invoke "core.cljc" 329]
[malli.core$schema invokeStatic "core.cljc" 2553]
[malli.core$schema invoke "core.cljc" 2531]
[malli.core$_schema_schema$reify__447771$fn__447772 invoke "core.cljc" 2045]
[malli.impl.util$_vmap invokeStatic "util.cljc" 28]
[malli.impl.util$_vmap invoke "util.cljc" 23]
[malli.core$_vmap invokeStatic "core.cljc" 266]
[malli.core$_vmap invoke "core.cljc" 266]
[malli.core$_schema_schema$reify__447771 _into_schema "core.cljc" 2045]
[malli.core$_lookup invokeStatic "core.cljc" 327]
[malli.core$_lookup invoke "core.cljc" 320]
[malli.core$_lookup_BANG_ invokeStatic "core.cljc" 331]
[malli.core$_lookup_BANG_ invoke "core.cljc" 329]
[malli.core$schema invokeStatic "core.cljc" 2553]
[malli.core$schema invoke "core.cljc" 2531]
[malli.core$_schema_schema$reify__447771$fn__447772 invoke "core.cljc" 2045]
[malli.impl.util$_vmap invokeStatic "util.cljc" 28]
[malli.impl.util$_vmap invoke "util.cljc" 23]
[malli.core$_vmap invokeStatic "core.cljc" 266]
[malli.core$_vmap invoke "core.cljc" 266]
[malli.core$_schema_schema$reify__447771 _into_schema "core.cljc" 2045]
[malli.core$_lookup invokeStatic "core.cljc" 327]
[malli.core$_lookup invoke "core.cljc" 320]
[malli.core$_lookup_BANG_ invokeStatic "core.cljc" 331]
[malli.core$_lookup_BANG_ invoke "core.cljc" 329]
[malli.core$schema invokeStatic "core.cljc" 2553]
[malli.core$schema invoke "core.cljc" 2531]
[malli.core$_schema_schema$reify__447771$fn__447772 invoke "core.cljc" 2045]
Let me know if there's anything I could run/try to get some more-useful data/insights!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status