Skip to content

Infinite recursion in spack spec #2495

@adamjstewart

Description

@adamjstewart

When I clone a fresh copy of Spack and run:

$ spack spec libxext
Input spec
--------------------------------
libxext

Normalized
--------------------------------
libxext
    ^[email protected]:
        ^inputproto
            ^[email protected]:
            ^util-macros
        ^kbproto
        ^[email protected]:
            ^libpthread-stubs
            ^[email protected]:
                ^[email protected]:
            ^libxdmcp
            ^python@2:2.8
                ^bzip2
                ^ncurses
                ^openssl
                    ^zlib
                ^readline
                ^sqlite
            ^xcb-proto
        ^[email protected]:
        ^xtrans

Concretized
--------------------------------
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.TypeError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.TypeError'> ignored
Traceback (most recent call last):
  File "./spack", line 198, in <module>
    main()
  File "./spack", line 175, in main
    return_val = command(parser, args)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/cmd/spec.py", line 78, in spec
    spec.concretize()
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1507, in concretize
    changes = (self.normalize(force),
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1809, in normalize
    any_change = self._normalize_helper(visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1763, in _normalize_helper
    pkg_dep, deptypes, visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1734, in _merge_dependency
    visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1763, in _normalize_helper
    pkg_dep, deptypes, visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1734, in _merge_dependency
    visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1763, in _normalize_helper
    pkg_dep, deptypes, visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1734, in _merge_dependency
    visited, spec_deps, provider_index)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1758, in _normalize_helper
    pkg_dep = self._evaluate_dependency_conditions(dep_name)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 1629, in _evaluate_dependency_conditions
    sat = self.satisfies(when_spec, strict=True)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2058, in satisfies
    return self.satisfies_dependencies(other, strict=deps_strict)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2087, in satisfies_dependencies
    self_index = ProviderIndex(self.traverse(), restrict=True)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/provider_index.py", line 87, in __init__
    self.update(spec)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/provider_index.py", line 99, in update
    pkg = spec.package
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 945, in package
    return spack.repo.get(self)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/repository.py", line 75, in converter
    return function(self, spec_like, *args, **kwargs)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/repository.py", line 318, in get
    return self.repo_for_pkg(spec).get(spec)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/repository.py", line 75, in converter
    return function(self, spec_like, *args, **kwargs)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/repository.py", line 567, in get
    key = hash(spec)
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/llnl/util/lang.py", line 254, in <lambda>
    setter('__hash__', lambda self: hash(self._cmp_key()))
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2330, in _cmp_key
    for name, d in sorted(self._dependencies.items()))
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2330, in <genexpr>
    for name, d in sorted(self._dependencies.items()))
...
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2330, in _cmp_key
    for name, d in sorted(self._dependencies.items()))
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2330, in <genexpr>
    for name, d in sorted(self._dependencies.items()))
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/llnl/util/lang.py", line 254, in <lambda>
    setter('__hash__', lambda self: hash(self._cmp_key()))
  File "/blues/gpfs/home/ajstewart/spack/lib/spack/spack/spec.py", line 2330, in _cmp_key
    for name, d in sorted(self._dependencies.items()))
TypeError: object of type 'generator' has no len()

This also occurs for me with other very large packages like dealii. Interestingly enough, I am unable to reproduce this on another computer. I've tried newer versions of Python but no luck. This definitely wasn't a problem until recently. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions