Uploaded image for project: 'ClojureScript'
  1. CLJS-3023

Instrumenting next gives maximum call stack size exceeded

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:
    • Approval:
      Accepted
    • Patch:
      Code and Test

      Description

      rest and last can be successfully instrumented, but next seems to be vulnerable to a maximum call stack size exceeded error.

      Repro:

      $ clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"} org.clojure/test.check {:mvn/version "RELEASE"}}}' -m cljs.main -re node -r
      ClojureScript 1.10.439
      cljs.user=> (require '[clojure.spec.alpha :as s])
      nil
      cljs.user=> (require '[clojure.spec.test.alpha :as stest])
      nil
      cljs.user=> (s/fdef clojure.core/next :args (s/cat :coll seqable?))
      cljs.core/next
      cljs.user=> (stest/instrument `next)
      repl:42
      throw e__6573__auto__;
      ^
      
      RangeError: Maximum call stack size exceeded
          at /private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:147:18
          at Object.G__47574__delegate (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:181:27)
          at Object.G__47574 [as next] (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:191:27)
          at Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$2 (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/core.js:13123:99)
          at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/core.js:13405:34)
          at cljs$core$apply (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/core.js:13358:24)
          at /private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:157:24
          at Object.G__47574__delegate (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:181:27)
          at Object.G__47574 [as next] (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/spec/test/alpha.js:191:27)
          at Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$2 (/private/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/out92072095452558798682044329212169952/cljs/core.js:13123:99)
      (node:11768) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
      cljs.user=>
      

      Patch CLJS-3023-2 provides a solution by going through the protocol method directly instead of using the function next in apply-to-simple. This seems reasonable, since this was already done to first as well.

      Patch CLJS-3023-3 restores the fallback for seqs that do not implement INext.

      Patch CLJS-3023-4 rebased on master.

        Attachments

        1. CLJS-3023.patch
          2 kB
        2. CLJS-3023-2.patch
          3 kB
        3. CLJS-3023-3.patch
          4 kB
        4. CLJS-3023-4.patch
          4 kB

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              borkdude Michiel Borkent
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: