-
Notifications
You must be signed in to change notification settings - Fork 2.4k
solver hangs when specifying a conditional variant which is not available for the given constraints #51245
Description
Steps to reproduce
; uname -s
Linux
; spack spec '[email protected]:+crypt'
# ... loops foreverI misunderstood the output of spack info python and wanted to see if there would be any different result when explicitly specifying +crypt. The variant declaration (as spack info correctly describes) does not apply to python over 3.12: https://github.com/spack/spack-packages/blob/7b3da595197d5f6c45dc4da44304d7917a113f99/repos/spack_repo/builtin/packages/python/package.py#L120-L121.
It's possible the platform=linux partial matching is inducing this error case.
I don't have time to fix this myself right now but I think it would be ok if we checked things like "specifying a variant that is not defined given the disjunction of when= clauses" and errored out earlier, in order to make this a more obvious failure mode.
However, I can see this necessitating a more thorough solution in the case of a package recipe declaring a dependency on a variant that doesn't exist. I think we could still look to identify that case up front instead of working too hard to fix it in the solver.
Notably, killing the spack process easily fixes the issue (I can continue to use the same terminal). Great work making such a robust CLI app ❤️ !
Error message
py-spy output from another terminal as this occurred:
; sudo py-spy top --native --pid 689550
Collecting samples from '/usr/bin/python3 /home/cosmicexplorer/spack-repos/s1/bin/spack -d spec python' (python v3.13.7)
Total Samples 700, Error Rate 16.86% (UNW_EBADREG: bad register number)
GIL: 58.00%, Active: 58.00%, Threads: 0
%Own %Total OwnTime TotalTime Function (filename)
0.00% 0.00% 0.700s 0.700s Clasp::ShortImplicationsGraph::forEach<Clasp::ShortImplicationsGraph::Propagate> (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.670s 1.41s Clasp::Solver::unitPropagate (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
57.00% 58.00% 0.570s 0.590s 0x7fca28027675 (libc.so.6)
0.00% 0.00% 0.200s 0.200s Clasp::ClaspVsids_t<Clasp::DomScore>::doSelect (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.150s 0.150s Clasp::ClaspVsids_t<Clasp::DomScore>::undoUntil (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.110s 0.120s Clasp::DefaultUnfoundedCheck::propagateSource (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.070s 0.070s Clasp::Asp::LogicProgram::getEqNode<bk_lib::pod_vector<Clasp::Asp::PrgAtom*, std::allocator<Clasp::Asp::PrgAtom*> > const> (clingo/_clingo.cpyth
0.00% 0.00% 0.060s 0.060s Clasp::Solver::undoLevel (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.040s 0.040s Clasp::DefaultUnfoundedCheck::removeSource (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.030s 1.71s Clasp::Solver::search (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.030s 0.100s std::_Function_handler<bool (unsigned int), Gringo::ClingoModel::atoms(unsigned int) const::{lambda(unsigned int)#1}>::_M_invoke (clingo/_clingo
0.00% 0.00% 0.030s 0.030s std::vector<Gringo::Symbol, std::allocator<Gringo::Symbol> >::emplace_back<Gringo::Output::PredicateAtom&> (clingo/_clingo.cpython-313-x86_64-li
0.00% 0.00% 0.020s 0.020s Clasp::DefaultUnfoundedCheck::propagate (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s 0x7fca28170373 (libc.so.6)
1.00% 1.00% 0.010s 0.010s __tls_get_addr (ld-linux-x86-64.so.2)
0.00% 0.00% 0.010s 0.010s Clasp::ClaspVsids_t<Clasp::DomScore>::updateVarActivity (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s 0x7fca2809f042 (libc.so.6)
0.00% 0.00% 0.010s 0.010s Clasp::DomainHeuristic::propagate (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s Clasp::Clause::updateWatch (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.150s Gringo::Output::Translator::atoms (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s Clasp::AcyclicityCheck::dfsBackward (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s Clasp::UncoreMinimize::initLevel (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.080s clingo_model_symbols (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s Clasp::DefaultUnfoundedCheck::addUnsourced (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.010s 0.010s Clasp::DefaultUnfoundedCheck::forwardUnsource (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s Clasp::AcyclicityCheck::propagateFixpoint (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s Clasp::DefaultUnfoundedCheck::createLoopFormula (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.120s Clasp::UncoreMinimize::push (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s Clasp::LoopFormula::LoopFormula (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.080s Clasp::DefaultUnfoundedCheck::updateAssignment (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s Clasp::ClaspVsids_t<Clasp::DomScore>::newConstraint (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.130s Clasp::UncoreMinimize::addNext (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s clingo_solve_handle_wait (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s finish_parse_and_run (spack/main.py)
0.00% 0.00% 0.000s 0.150s Gringo::Output::OutputBase::atoms (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.130s Clasp::Solver::popRootLevel (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.280s Clasp::DefaultUnfoundedCheck::propagateFixpoint (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.160s symbols (clingo/solving.py)
0.00% 0.00% 0.000s 0.010s _invoke_command (spack/main.py)
0.00% 0.00% 0.000s 0.010s Clasp::ClaspFacade::SolveStrategy::Async::doWait (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.700s Clasp::ShortImplicationsGraph::propagate (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.200s Clasp::DomainHeuristic::doSelect (clingo/_clingo.cpython-313-x86_64-linux-gnu.so)
0.00% 0.00% 0.000s 0.010s wait (clingo/solving.py)Information on your system
I'm solving for platform=linux, where the +crypt variant is defined, but for a version above 3.12.
This may also be more immediately solvable by defining crypt in all scenarios, while making it more or less a no-op. Unsure how much this indicates a design issue.
This really wouldn't come up unless a user likes playing with random options--I had just fixed an issue with using the freshly-built CPython without the gil so I was worried that was still causing an issue (setting SPACK_PYTHON resolves all issues). However, it is notable that it occurs on the python dependency, which is a very common thing for people to want to build in strange ways.
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Metadata
Metadata
Assignees
Labels
Type
Projects
Status