Bundler在安装或更新宝石时卡住了

时间:2023-02-02 00:18:49

I recently tried to run bundle update and one of my cores was stuck at 100%. I tried to reset everything, including deleting my RVM gemset but nothing helped.

我最近尝试运行捆绑更新,其中一个核心卡在100%。我试图重置所有内容,包括删除我的RVM gemset,但没有任何帮助。

I used bundle install --verbose to see what's going on and the whole process stopped at this point:

我使用bundle install --verbose来查看发生了什么,整个过程在此时停止:

Unmet Dependencies: ["spicycode-rcov", "tenderlove-frex"]
Fetching gem metadata from http://rubygems.org/
Query List: ["spicycode-rcov", "tenderlove-frex"]
Query Gemcutter Dependency Endpoint API: spicycode-rcov tenderlove-frex
Fetching from: http://rubygems.org/api/v1/dependencies?gems=spicycode-rcov,tenderlove-frex
HTTP Success
Query List: []

How do I solve this?

我该如何解决这个问题?

1 个解决方案

#1


5  

I've encountered this behaviour several times. Bundler is likely not stuck, but rather is exploring a degenerately large search space of possible gem versions. You can get detailed debug information about how it is evaluating possibilities by setting env var DEBUG_RESOLVER=1. Read "How does Bundler bundle?" to understand the algorithm and the output of of the resolver trace.

我好几次遇到过这种行为。 Bundler可能不会卡住,而是正在探索可能的宝石版本的退化大型搜索空间。通过设置env var DEBUG_RESOLVER = 1,您可以获得有关如何评估可能性的详细调试信息。阅读“Bundler如何捆绑?”了解解析器跟踪的算法和输出。

I worked around the problem by identifying a gem from the trace over which Bundler was consistently backtracking and retrying many different candidate versions and constraining the versions to greater than some recent version. This often helps Bundler substantially reduce the search space and complete its evaluation rapidly. Of course, the constraint you add may produce an unresolvable conflict with another gem's requirement, in which case you can incrementally relax your constraint until it's compatible.

我通过从跟踪器中识别出一个宝石来解决这个问题,其中Bundler一直在回溯并重试许多不同的候选版本并将版本限制为大于某些最新版本。这通常有助于Bundler大幅减少搜索空间并快速完成其评估。当然,您添加的约束可能会产生与另一个gem的要求无法解决的冲突,在这种情况下,您可以逐步放宽约束,直到它兼容。

I have a personal TODO to go back to one of these degenerate resolve conditions and transform it to a set of dependencies and version histories that can all be made public so I can submit a reproducible issue to the Bundler devs. (Many of our gems are private to our company.) This comment in the source indicates they think the algorithm always completes in reasonable time, but empirically there are difficult cases that have valid solutions that can't be solved with hours of computation.

我有一个个人TODO回到这些退化的解决条件之一并将其转换为一组依赖关系和版本历史,这些都可以公开,所以我可以向Bundler开发者提交可重现的问题。 (我们的许多宝石都是我们公司的私人宝石。)源中的这条评论表明他们认为算法总是在合理的时间内完成,但根据经验,有一些困难的案例具有无法通过计算时间解决的有效解决方案。

If your situation turns out to be akin to mine, but relies entirely on public gems, it would be a service to the community if you could make the problem gemfile and gemset public and submit an issue to Bundler so someone who knows the algorithm deeply can improve it.

如果您的情况与我的情况相似,但完全依赖于公共宝石,那么如果您可以将问题gemfile和gemset公开并向Bundler提交问题,那么它将是对社区的服务,因此深入了解该算法的人可以改进它。

Issue #2030 indicates that there may be a bug where the resolver actually gets stuck in an infinite loop. If you see evidence of that, you may want to submit your gemfile to that issue, especially if your reproduce case is smaller than the already submitted one(s).

问题#2030表示可能存在解析器实际陷入无限循环的错误。如果您看到了这方面的证据,您可能希望将gem文件提交到该问题,特别是如果您的复制案例小于已提交的案例。

#1


5  

I've encountered this behaviour several times. Bundler is likely not stuck, but rather is exploring a degenerately large search space of possible gem versions. You can get detailed debug information about how it is evaluating possibilities by setting env var DEBUG_RESOLVER=1. Read "How does Bundler bundle?" to understand the algorithm and the output of of the resolver trace.

我好几次遇到过这种行为。 Bundler可能不会卡住,而是正在探索可能的宝石版本的退化大型搜索空间。通过设置env var DEBUG_RESOLVER = 1,您可以获得有关如何评估可能性的详细调试信息。阅读“Bundler如何捆绑?”了解解析器跟踪的算法和输出。

I worked around the problem by identifying a gem from the trace over which Bundler was consistently backtracking and retrying many different candidate versions and constraining the versions to greater than some recent version. This often helps Bundler substantially reduce the search space and complete its evaluation rapidly. Of course, the constraint you add may produce an unresolvable conflict with another gem's requirement, in which case you can incrementally relax your constraint until it's compatible.

我通过从跟踪器中识别出一个宝石来解决这个问题,其中Bundler一直在回溯并重试许多不同的候选版本并将版本限制为大于某些最新版本。这通常有助于Bundler大幅减少搜索空间并快速完成其评估。当然,您添加的约束可能会产生与另一个gem的要求无法解决的冲突,在这种情况下,您可以逐步放宽约束,直到它兼容。

I have a personal TODO to go back to one of these degenerate resolve conditions and transform it to a set of dependencies and version histories that can all be made public so I can submit a reproducible issue to the Bundler devs. (Many of our gems are private to our company.) This comment in the source indicates they think the algorithm always completes in reasonable time, but empirically there are difficult cases that have valid solutions that can't be solved with hours of computation.

我有一个个人TODO回到这些退化的解决条件之一并将其转换为一组依赖关系和版本历史,这些都可以公开,所以我可以向Bundler开发者提交可重现的问题。 (我们的许多宝石都是我们公司的私人宝石。)源中的这条评论表明他们认为算法总是在合理的时间内完成,但根据经验,有一些困难的案例具有无法通过计算时间解决的有效解决方案。

If your situation turns out to be akin to mine, but relies entirely on public gems, it would be a service to the community if you could make the problem gemfile and gemset public and submit an issue to Bundler so someone who knows the algorithm deeply can improve it.

如果您的情况与我的情况相似,但完全依赖于公共宝石,那么如果您可以将问题gemfile和gemset公开并向Bundler提交问题,那么它将是对社区的服务,因此深入了解该算法的人可以改进它。

Issue #2030 indicates that there may be a bug where the resolver actually gets stuck in an infinite loop. If you see evidence of that, you may want to submit your gemfile to that issue, especially if your reproduce case is smaller than the already submitted one(s).

问题#2030表示可能存在解析器实际陷入无限循环的错误。如果您看到了这方面的证据,您可能希望将gem文件提交到该问题,特别是如果您的复制案例小于已提交的案例。