Carthage: Infinite Loop and taking huge memory and hight cpu usage

Created on 8 Apr 2019  路  7Comments  路  Source: Carthage/Carthage

  • carthage install method: [ ] .pkg, [鈽戯笍 ] homebrew, [ ] source
  • which carthage:
  • carthage version: 0.32.0
  • xcodebuild -version: 10.2
  • Are you using --no-build? YES
  • Are you using --no-use-binaries? YES
  • Are you using --use-submodules? NO
  • Are you using --cache-builds? NO
  • Are you using --new-resolver? NO

Cartfile

 github "ReactiveCocoa/ReactiveCocoa" ~> 9.0.0
 github "Moya/Moya"  ~> 12.0.1
 github "danielgindi/Charts" ~> 3.0.4
 github "tadija/AEXML"
 github "ViccAlexander/Chameleon"
 github "hackiftekhar/IQKeyboardManager"
 github "jdg/MBProgressHUD" ~> 1.0.0
 github "SwiftyJSON/SwiftyJSON"
 github "ninjaprox/NVActivityIndicatorView"
 github "patchthecode/JTAppleCalendar" ~> 7.1.2
 github "onevcat/Kingfisher" ~> 4.0

When i do

carthage bootstrap  --platform ios --color auto --no-use-binaries --no-build

or run carthage xcode project.
I found carthage are fetching depences and come into infinite loop.

    private func graphs(
        for nodes: [DependencyNode],
        dependencyOf: DependencyNode?,
        basedOnGraph inputGraph: DependencyGraph
    ) -> SignalProducer<DependencyGraph, CarthageError> {
        let scheduler = QueueScheduler(qos: .default, name: "org.carthage.CarthageKit.Resolver.graphs")

        return SignalProducer<(DependencyGraph, [DependencyNode]), CarthageError> { () -> Result<(DependencyGraph, [DependencyNode]), CarthageError> in
                var graph = inputGraph
                return graph
                    .addNodes(nodes, dependenciesOf: dependencyOf)
                    .map { newNodes in
                        return (graph, newNodes)
                    }
            }
            .flatMap(.concat) { graph, nodes -> SignalProducer<DependencyGraph, CarthageError> in
                return SignalProducer(nodes)
                    // Each producer represents all evaluations of one subtree.
                    .map { node in self.graphsForDependenciesOfNode(node, basedOnGraph: graph) }
                    .observe(on: scheduler)
                    .permute()
                    .flatMap(.concat) { graphs -> SignalProducer<Signal<DependencyGraph, CarthageError>.Event, NoError> in
                        return SignalProducer<DependencyGraph, CarthageError> {
                                mergeGraphs([ inputGraph ] + graphs)
                            }
                            .materialize()
                    }
                    // Pass through resolution errors only if we never got
                    // a valid graph.
                    .dematerializeErrorsIfEmpty()
            }
    }

in the code

 self.graphsForDependenciesOfNode(node, basedOnGraph: graph)

call the

 func graphs(
        for nodes: [DependencyNode],
        dependencyOf: DependencyNode?,
        basedOnGraph inputGraph: DependencyGraph
    ) -> SignalProducer<DependencyGraph, CarthageError> 

again and carthage turn into a infinite loop. I don't how jump out this loop.
Someone can tell me some tips to solve this problem?

stale

Most helpful comment

--new-resolver works for me

All 7 comments

i print graph in mergeGraphs

private func mergeGraphs
    <C: Collection>
    (_ graphs: C) -> Result<DependencyGraph, CarthageError>
    where C.Iterator.Element == DependencyGraph {
    precondition(!graphs.isEmpty)
        print(graphs)
         .....
}

and get the graph of that

[Roots:
    github "ViccAlexander/Chameleon" @ "2.2.0" (restricted to )
    github "jdg/MBProgressHUD" @ "1.1.0" (restricted to ~> 1.0.0)
    github "Moya/Moya" @ "12.0.1" (restricted to ~> 12.0.1)
    github "hackiftekhar/IQKeyboardManager" @ "v6.2.1" (restricted to )
    github "patchthecode/JTAppleCalendar" @ "7.1.7" (restricted to ~> 7.1.2)
    github "ReactiveCocoa/ReactiveCocoa" @ "9.0.0" (restricted to ~> 9.0.0)
    github "ninjaprox/NVActivityIndicatorView" @ "4.7.0" (restricted to )
    github "danielgindi/Charts" @ "v3.2.2" (restricted to ~> 3.0.4)
    github "SwiftyJSON/SwiftyJSON" @ "4.3.0" (restricted to )
    github "onevcat/Kingfisher" @ "4.10.1" (restricted to ~> 4.0.0)
    github "tadija/AEXML" @ "4.4.0" (restricted to )

Edges:
    github "ReactiveCocoa/ReactiveCocoa" ->
        github "ReactiveCocoa/ReactiveSwift" @ "5.0.1" (restricted to ~> 5.0.0), Roots:
    github "ViccAlexander/Chameleon" @ "2.2.0" (restricted to )
    github "jdg/MBProgressHUD" @ "1.1.0" (restricted to ~> 1.0.0)
    github "Moya/Moya" @ "12.0.1" (restricted to ~> 12.0.1)
    github "hackiftekhar/IQKeyboardManager" @ "v6.2.1" (restricted to )
    github "patchthecode/JTAppleCalendar" @ "7.1.7" (restricted to ~> 7.1.2)
    github "ReactiveCocoa/ReactiveCocoa" @ "9.0.0" (restricted to ~> 9.0.0)
    github "ninjaprox/NVActivityIndicatorView" @ "4.7.0" (restricted to )
    github "danielgindi/Charts" @ "v3.2.2" (restricted to ~> 3.0.4)
    github "SwiftyJSON/SwiftyJSON" @ "4.3.0" (restricted to )
    github "onevcat/Kingfisher" @ "4.10.1" (restricted to ~> 4.0.0)
    github "tadija/AEXML" @ "4.4.0" (restricted to )

Edges:
    github "ReactiveCocoa/ReactiveCocoa" ->
        github "ReactiveCocoa/ReactiveSwift" @ "5.0.1" (restricted to ~> 5.0.0)
        github "antitypical/Result" @ "4.1.0" (restricted to ~> 4.1.0)
    github "ReactiveCocoa/ReactiveSwift" ->
        github "antitypical/Result" @ "4.1.0" (restricted to ~> 4.1.0)]

I thought problem was caused by same dependencies in both of edges and root

--new-resolver works for me

You may also want to check out our fork of Carthage which has a completely rewritten resolver which fixes a lot if not all of the resolver issues you may have, verified with a lot of real-world test cases:

https://github.com/nsoperations/Carthage

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

馃憢 @stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

There might still be a problem. We get the infinite loops on a regular basis, but --new-resolver fixed the problem!

Was this page helpful?
0 / 5 - 0 ratings