tools.namespace

Stack overflow on cyclic dependency

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

If a cyclic dependency is introduced between a namespace and itself, it results in a StackOverflow when calculating transitive-dependencies.

(transitive-dependencies (-> (graph)
                             (depend 'two 'two))
                         'two)
; => StackOverflow

I believe clojure.tools.namespace.dependency/transitive should maintain a set of seen namespaces and check if we have already seen the namespace at each step.

Activity

Ambrose Bonnaire-Sergeant made changes -
Field Original Value New Value
Description If a cyclic dependency is introduced between a namespace and itself, it results in a StackOverflow when calculating transitive-dependencies.


(transitive-dependencies (-> (graph)
                             (depend 'two 'two))
                         'two)
; => StackOverflow

I believe clojure.tools.namespace.dependency/transitive should maintain a set of seen namespaces and check if we have already seen the namespace at each step.
If a cyclic dependency is introduced between a namespace and itself, it results in a StackOverflow when calculating transitive-dependencies.

{code}
(transitive-dependencies (-> (graph)
                             (depend 'two 'two))
                         'two)
; => StackOverflow
{code}

I believe clojure.tools.namespace.dependency/transitive should maintain a set of seen namespaces and check if we have already seen the namespace at each step.
Hide
Stuart Sierra added a comment -

Already fixed in 0.2.4-SNAPSHOT by forbidding cyclic dependencies: https://github.com/clojure/tools.namespace/commit/85e73af04fdb497db1600ef3bf21aef5ed676619

Show
Stuart Sierra added a comment - Already fixed in 0.2.4-SNAPSHOT by forbidding cyclic dependencies: https://github.com/clojure/tools.namespace/commit/85e73af04fdb497db1600ef3bf21aef5ed676619
Stuart Sierra made changes -
Resolution Declined [ 2 ]
Status Open [ 1 ] Resolved [ 5 ]
Stuart Sierra made changes -
Status Resolved [ 5 ] Reopened [ 4 ]
Resolution Declined [ 2 ]
Stuart Sierra made changes -
Resolution Completed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Hide
Stuart Sierra added a comment -

Mark old resolved issues as 'closed'

Show
Stuart Sierra added a comment - Mark old resolved issues as 'closed'
Stuart Sierra made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: