Skip to content

Add recursive option #78

Open

Description

@styfle

It would be nice to pass a URL and have it crawl the entire website recursively looking for dead links.

In order to avoid crawling the entire internet, it should stop recursing once a request no longer matches the original domain.

Activity

  1. mre commented on Dec 14, 2020

    @mre
    Member

    Yeah it has been discussed a few times already and it's high on the todo-list.
    Will require quite some restructuring I guess.
    Right now the flow is

    main -> extractor -> channel -> client (link checker) -> main
    

    but there is no connection back to the extractor.

  2. added
    enhancement
    on Dec 14, 2020
  3. frederickjh commented on Mar 24, 2021

    @frederickjh

    The lack of recursive spidering make this project unusable for my purpose of checking all links internal and external on a website. I am trying to find a replacement for michaeltelford/broken_link_finder . It is written in Ruby and with out super user access a the new place where this will run it is impossible to install. I am looking for a "portable" replacement. I worked with michaeltelford to get his project into a much more usable state. Check out that projects issue queue for some of the reasoning that went into the development.

    In any case regarding this issue. The spidering should stop with links found on the current domain, but the links found to external sources should still be checked.

  4. mre commented on Mar 24, 2021

    @mre
    Member

    #165 is getting very close to completion. It implements the functionality described. If you like to support, please build the version from that branch and test it. Feedback on the pull request is appreciated.

  5. frederickjh commented on Mar 25, 2021

    @frederickjh

    @mre I am new to rust but it seemed pretty straight forward as to how to build from Working on an Existing Cargo Package. However I have run into an issue. At first I thought it was a credential issue but it looks like a 404 issue.

    image

    Caused by:
    Unable to update https://github.com/amaurym/async-smtp?branch=am-fast-socks#eac57391

    That GitHub URL returns a 404 so I am not sure how to proceed to build.

    Rust information:

    $ rustc --version
    rustc 1.50.0 (cb75ad5db 2021-02-10)
    $ rustup --version
    rustup 1.23.1 (3df2264a9 2020-11-30)
    info: This is the version for the rustup toolchain manager, not the rustc compiler.
    info: The currently active `rustc` version is `rustc 1.50.0 (cb75ad5db 2021-02-10)`
    $ cargo --version
    cargo 1.50.0 (f04e7fab7 2021-02-04)

    The GitHub repository amaurym/async-smtp does not seem to exist anymore.
    Not sure how to proceed. Please advise. Thanks!

  6. frederickjh commented on Mar 25, 2021

    @frederickjh

    I dug through the Cargo.lock file for reacherhq/check-if-email-exists and found this line with the source for async-smtp

    source = "git+https://github.com/async-email/async-smtp?branch=master#0f1c4c6a565833f8c7fc314de84c4cbbc8da2b4a"

    So it looks like the source for async-smtp has moved to async-email/async-smtp.

  7. frederickjh commented on Mar 25, 2021

    @frederickjh

    Just found #189 which is the same issue I reported here as to why the build fails.

  8. mre commented on Mar 25, 2021

    @mre
    Member
  9. frederickjh commented on Mar 25, 2021

    @frederickjh

    Ah, upstream reacherhq/check-if-email-exists updated to use upstream instead of his fork three days ago. I am guessing he also deleted the fork then, but this project is still using it.

    See here: chore: Update wording around licenses #892

    This repository still has references to his fork that no longer exists on both the master and simple-recursion branches in the Cargo.lock files. There is a comment in the Cargo.toml file that says:

    # Switch back to version on crates.io after
    # https://github.com/async-email/async-smtp/pull/36
    # is merged and a new version of check-if-email-exists is released
    

    So it looks like pull 36 in the upstream is closed but the new crate has not been published as the newest one is dated January 10.

    @mre let me know if there is any movement on this and I will then try to build from the simple-recursion branch and test.

  10. frederickjh commented on Apr 13, 2021

    @frederickjh

    Upstream is reporting:

    This is fixed in 0.8.21

    but I still cannot bulid from the simple-recursion branch, so I think something needs work there too be for this will build.

  11. frederickjh commented on Apr 14, 2021

    @frederickjh

    So, I think that the version of async-email/async-smtp needs to be upgraded from 0.8.19 to 0.8.21 for the simple-recursion branch to build.

  12. mre commented on Apr 14, 2021

    @mre
    Member

    Thanks for the info. I'll tackle that once #208 is merged. 😄

  13. frederickjh commented on May 7, 2021

    @frederickjh

    @mre I see that #208 got merged back in April. Let me know if you get this branch to the point where it will build and I can then test it.

  14. frederickjh commented on May 19, 2021

    @frederickjh

    @mre I am still willing to test this but I will be finished with my current job in second week of June and may not have a need for it after that for a while. I would like to get this setup to replace the current program that we are using to check for broken links that I cannot easily move to a shared server because it is ruby. Let me know if you get the version of simple-recursion changed so that this branch builds and I will test it.

  15. mre commented on May 19, 2021

    @mre
    Member

    Thanks for your patience. Want to work on this as soon as I find the time. No guarantees this will be soon, though. 😅

  16. 32 remaining items

  17. lkwg82 commented on Apr 4, 2026

    @lkwg82

    any progress on this issue?

  18. mre commented on Apr 4, 2026

    @mre
    Member

    Work has been happening on #1898, which discusses architectural changes that will make recursion support a by-product of that refactor. We'd appreciate any input there, although the discussion is about intricate details of lychee's design, which could be a bit harder to grasp without additional knowledge.

    We support sitemaps now as part of #2062, which is a useful workaround for many websites.

    We unified request handling in #1886. This way, CLI inputs and links discovered at runtime are treated the same. That unification helps with adding recursion support in the future.

    There are a few more bits and pieces we merged that get us closer to recursion support, but it's still a long way to go.

  19. mre commented on Apr 4, 2026

    @mre
    Member

    Actually, I totally forgot to mention the most important recent development, which is the WaitGroup primitive by @katrinafyi, merged in PR #2046. This directly addresses the termination problem that defeated every prior attempt.

    WaitGroup is an RAII-based mechanism for waiting on a dynamic set of tasks that can spawn other tasks. It consists of:

    • WaitGroup: A single waiter that detects when all work is done, and
    • WaitGuard: A clonable guard held by each task. When all guards are dropped, the waiter completes.

    The key insight is that WaitGuard can be cloned, allowing a task to spawn sub-tasks (recursion!) while maintaining the invariant that the WaitGroup only completes when all guards (including those held by recursive sub-tasks) are dropped.

    This solves our termination problem:

    let (waiter, guard) = WaitGroup::new();
    
    // Each request carries a guard clone
    send_req.send((guard.clone(), request)).await;
    
    // In the response handler, if recursing:
    // The guard is cloned for each new request
    for new_request in discovered_links {
        send_req.send((guard.clone(), new_request)).await;
    }
    
    // The original guard is dropped when the response is fully processed.
    // When ALL guards are dropped (no more work), waiter.wait() returns.

    The WaitGroup is already integrated into lychee's main check loop. The collect_responses function uses take_until(waiter.wait()) to stop receiving when all work is done. The current code even has a comment anticipating recursion:

    // unused for now, but will be used for recursion eventually. by holding
    // an extra `send_req` endpoint, we prevent the natural termination when
    // each channel finishes and closes. instead, we rely on the WaitGroup to
    // break the cyclic channels.
    let _ = send_req;

    This is the missing piece that all four previous attempts (#165, #465, #489, #1603) lacked.

    Another important one is per-host rate limiting (#1929), which ensures that recursive crawling respects server limits. This removes a major blocker that was previously deemed "out of scope" but was in practice essential for real-world recursion.

  20. mre commented on Apr 4, 2026

    @mre
    Member

    I think the biggest meta-lesson for me is that recursion cannot be landed as a single massive PR. The successful path is to land prerequisites incrementally. We are already on a good trajectory by landing functionality like the following:

    • WaitGroup for dynamic task termination
    • Unified request handling through HostPool
    • Per-host rate limiting
    • Sitemap support as a discovery mechanism

    Each of these were reviewed, tested, and merged independently, which helped us keep up the momentum.
    The project is now in the best position it's ever been. The WaitGroup solves termination. Unified host pools solve configuration consistency. Per-host rate limiting prevents accidental DDoS. We should continue down that path as it has proven to be the most promising so far.

  21. 6543 commented on Apr 4, 2026

    @6543

    In this regard, what would be the rough roadmap till recursion?
    so to let people know what to focus on if interested in this issue ;)

  22. almereyda commented on Apr 6, 2026

    @almereyda

    To me your question is answered in the post before yours.

  23. mre commented on Apr 7, 2026

    @mre
    Member

    what would be the rough roadmap till recursion?

    I cannot give you a roadmap for recursion at the moment, but there's ongoing work here that we'd like to get feedback on:

  24. tomashofmanng commented on Aug 2, 2026

    @tomashofmanng

    @lfrancke, does your 100 EUR PayPal/SEPA offer still stand in 2026? Since the maintainers prefer incremental prerequisites rather than another large recursion PR, would you also be willing to split the bounty for a focused contribution that is explicitly accepted as advancing recursion support?

    @mre, if so, could you point me to the smallest currently unclaimed prerequisite or acceptance gap worth tackling? I noticed PR #2229 overlaps the channel-lifetime design, so I want to avoid duplicating active work.

  25. lrt950 commented on Aug 17, 2026

    @lrt950

    I implemented the recursive website checker in #2283. It uses the existing WaitGroup/shared HostPool groundwork, adds domain and depth controls, and includes regression coverage for the bounded-channel deadlock, external domains, and redirects.

    @lfrancke, this is intended to cover the full feature from your 100 EUR bounty offer. If the maintainers accept and merge it, I can coordinate PayPal payout details privately.

  26. lfrancke commented on Sep 4, 2026

    @lfrancke

    Hi, sorry for the late response: Yes, the offer still stands. I'm happy to split it up as well, yes.

  27. FloatingPegasus commented on Sep 8, 2026

    @FloatingPegasus

    I reproduced a separate depth-limit correctness issue in #2283: if a longer route reaches a shared page before a delayed shorter route, the crawler can exit successfully while missing a broken descendant inside --max-depth.

    The focused fix and local regression are submitted to the feature branch at lrt950#2. The regression fails on the current feature branch and on the companion deduplication implementation; with this patch all seven local recursion CLI tests pass, together with Clippy and formatting checks. The PR documents the integration needed if the deduplication patch lands first.

    @lfrancke, thanks for reconfirming the shared reward. If this contribution is accepted into the completed feature, would a €20 share be available for this depth-correctness work? I understand the €100 is the total pool shared with the feature author and other contributors, and that no share is agreed yet.

  28. sen-ye commented on Sep 8, 2026

    @sen-ye

    @lfrancke, thank you for reconfirming the shared €100 bounty. I submitted a distinct companion fix at lrt950#3: recursive content-fetch failures now fail the CLI, and malformed links remain visible in the error summary while valid links are still checked.

    The PR contains two local regressions, eight passing recursive tests, and passing all-target/all-feature Clippy. It also records the external-network failures in the broader local and public CI suites.

    If this patch is accepted into #2283 and the completed recursive feature lands upstream, would a €20 share of the existing pool be available through PayPal? I understand that the allocation is still your decision. Payment details can be exchanged privately after confirmation.

    OpenAI Codex authored and tested this contribution on behalf of @sen-ye.

  29. lfrancke commented on Sep 8, 2026

    @lfrancke

    I have no idea where all this activity is coming from all of a sudden. I'm sorry @mre, I didn't mean to attract unwanted PRs/work.
    I was also contacted via mail. Please stop that. I am happy to honor my bounty for whenever this is implemented at my very own discretion. I don't know anything about the details that need to get done to implement this and I don't want to deal with the details either. This was meant as a well intentioned incentive years ago. I don't know how many people there are behind these accounts and I don't know wheret his sudden interest comes from.

  30. sen-ye commented on Sep 8, 2026

    @sen-ye

    Sorry for adding to the noise and creating extra coordination work. I have withdrawn my bounty-share request and closed my companion PR at lrt950#3. I will not contact you further about payment. Thank you for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrequest-for-comments

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions