Skip to content

long chains of Deferred values hang #48

@mccraigmccraig

Description

@mccraigmccraig

i came across this while debugging another problem

(defn chain-delay-deferred
  [n t]
  (let [f (manifold.deferred/deferred)]
    (future (Thread/sleep t) (manifold.deferred/success! f 100))
    (reduce (fn [d i] (manifold.deferred/chain d (fn [v] (+ v i))))
            f
            (range 0 n))))

@(chain-delay-deferred 100 1000) ;; 5050
@(chain-delay-deferred 100000 1000) ;; hangs

there are some values of n where it hangs on some runs and returns on other runs. on my machine

@(chain-delay-deferred 4567 1000)

seems to hang about half the time

i ran this against the current tip of master 4e1fff70c5380b33e9cc2f50f03ce16af6d393b4, but i was observing the same problem against 0.1.1-alpha3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions