-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composer job run timing out #2416
Comments
I opened an Enterprise Github support ticket for this but didn't get a confirmation because I wasn't logged in, and am having a tough time even after logging in getting an email to verify my email, our mail server must be blocking it. |
Hi @ElijahLynn, it looks like the updates are legitimately timing out, we currently have a hard limit of 30 minutes for an update job, and composer is known to sometimes be on the slow side. Right now I would recommend that you retry the failed jobs from the UI, and I will create an issue on our backlog to see if we can give some ecosystems a longer timeout. |
Thanks @jurre, I have seen Packagist.org (composer's default source) hang sometimes and wonder if that may be it. Can you expose more info on why it is timing out? The timeout is hanging on a step just after getting some package metadata. I don't think this needs a longer timeout, I think there is a bug here and something needs to be caught and bubbled up.
The last successful GET 200 happens at 00:30:10 here and then the timeout happens 19 seconds later at 00:30:29. |
Oh, I see now, yeah, it is 30 minutes as it all started at 00:00:00 in this log https://github.com/department-of-veterans-affairs/va.gov-cms/network/updates/44795731. I wonder why it takes so long as a full |
Hrm, I am suspecting it is because it is checking if all sub-dependencies need updating as well. I'll look and see if there is a setting to stop that and see how long it takes. |
K, we removed the indirect dependency resolution and it is still timing out now. @jurre I suspect this is actually timing out for most sites like ours which are Drupal 8/Symfony based. Can you increase the timeout of the Compser-based projects as you mentioned that you will create an issue in your backlog for? Thanks |
Thanks for investigating this further @ElijahLynn, an issue for this is currently on our backlog and we've already shipped some initial improvements needed to start making this possible. Not sure when the final changes will land, but will be sure to report back here! |
We've increased the timeout for composer updates from 30m to 45, would love to hear if this solves your issue @ElijahLynn |
That's a bummer. Just out of curiosity, does it take this long on your local machine to run composer as well? I see the repo is publicly available so I will try running dependabot on it locally to see what is taking so much time |
Not sure if I should open another issue or just comment on this one 😅 - seeing the exact same error since switching to github dependabot. Not with Contacted support for this a few months ago and they "increased the timeout for npm updates from 30m to 45", which didn't help as well. |
No need to open a separate issue.
We've seen this before with large monorepo's, I'm curious how long running |
answering for @sakulstra here:
On a t495s with a ryzen7 though. |
Ah, I see you're running |
but we have been using lerna before too, this is a problem since we moved to the "in github"-version. |
It's hard to diagnose what's going on without access to the project, has anything in the setup changed? Lerna kind of works when using I can't think of a reason why it would timeout for the GitHub native version, both are using the same version of dependabot-core etc. Have you looked at the logs for any clues? |
No, it only takes about 4 minutes to run locally, a full |
I seem to be getting timeouts as well in GitHub Dependabot - "Dependabot timed out during its update". I'm not seeing any logs, but it may be due to the same reason. I just set it up yesterday, although Dependabot via dependabot.com had been working fine. Repo is: https://github.com/BrightspaceUI/core/network/updates |
Also timing out (after 45min). Looks like log is no longer available. This is start/end from the log.
|
We see the same issue with composer in Symfony/Drupal 8 Looking at the log it's almost as if it is running a composer update PER DEPENDENCY, so that although a composer update is less than a minute - across 50-60 updates it would run it that many times and effectively timeout. It seems to also be hitting the proxy for requests to packages repositories on each check - but not just to check that dependency - it is pulling metadata for every single package in the composer.json even though it's then realising that specific dependency has no update. Not sure if these proxy log entries show it is caching or not. I can't copy and paste any of the logs as it crashes the browser because it's so long. It seems each log line is inside a DIV so there's thousands of DIVs in the page and the browser just chokes. |
Turns out this is due to composer preferring to check for updates to various metadata on each run. However, when you've got Drupal in there, the package repository works differently somehow and there's also many 404s happening too. And it hits all the same files on each run, taking over a minute each dependency. I've tested a patched version of Composer v2 locally which has a This reduced my time-per-dependency from over 1 minute to less than 5 seconds. And reduces network activity significantly. Issue is that composer is unlikely to accept the above as |
I don't think that's really feasible with how Dependabot currently works. I do wonder if we can patch our helper to make more effective use of the |
@jurre the prefer-cache is something I wrote whilst testing. So doesn’t exist currently. And I’m unsure if such an option should even exist. |
@jurre I'm having some pretty alarmingly improved results with a few smaller changes. One big improvement, especially for the update process that produces the lock file, was to replace the LibraryInstaller with a custom one that is NOOP like the MetapackageInstaller. It gets rid of the download step. Of course plugins likely still need downloading so they can effect the installations but to be honest not even sure if that is necessary for this purpose? I can imagine for GitHub that might save a huge amount of bandwidth and help save the planet? 😉 To stop the massive network usage for metadata files and try to maintain the composer cache I found a way that is less impactful change than adding options to composer. It involves serialising the composer object (see below - not currently possible) after each run, then loading it on next run and just replacing the RootPackage and Locker with new versions based on the run's composer.json/lock. It reduces the network requests from Composer to literally just those needed for the additional run. Only issue is it feels a bit hacky replacing the RootPackage and Locker and technically the config source stuff still points to that from the first run - but could be worth checking with Composer if it's save mid-run to replace the RootPackage and Locker to re-run installations etc. Regarding not able to serialise - it's one single object, the CurlDownloader - that stores a resource in constructor. Just needs a __wakeup to reinitialise. Will try to get back to this soon again and raise a PR possibly for the LibraryInstaller stub unless someone gets to it - as that seems like might speed things overall in a relatively simple way by avoiding download packages. In my test Drupal 8 Symphony project - with many updates needed - the dry-run drops from >1 hour to about 30 minutes with caching alone - then with the LibraryInstaller NOOP it drops to about 10 minutes. |
Gonna do testing with just the LibraryInstaller NOOP. I am wondering if the caching is not a huge help - or maybe only help with Drupal packages which generate lots of requests as opposed to non-Drupal which don't. |
I moved the investigation bits I did into #2999 @jurre and raised #2998 with the LibraryInstaller/InstallationManager bit. |
An FYI for others blocked by this issue: while we wait for a Dependabot mitigation/solution, we have implemented an alternative tool as a workaround to keep our Composer packages up to date. An interesting part of this work was discovering that this other tool is not experiencing the same slowdown that Dependabot is. |
@markdorison The improvements noted here are fairly minor - the main slowdowns are due to problems in composer’s dependency resolution. I’m unsure how another tool would work past that other than implement its own resolution code. |
@driskell I hear you. Maybe that is what they chose to do? I just wanted to share since it might help others in the short term. We would really like to get Dependabot back up and running on our affected repos. |
@markdorison If it helps, it'll be worth looking at the following issues that I think would benefit not only dependabot but users of various frameworks like Drupal. The latter two are ones that specifically target speed issues scanning Drupal projects (and I think any other project with large dependency trees with lots of conflict rules). Things seems to have slowed down as generally speaking from composer side - OK it's slow but it still works. Only becomes a major issue when attempting to automate composer under time constraints. composer/composer#9261 |
composer/composer#9261 has been merged and included in composer 2.2.8. Would it be possible to see that included in a new dependabot release so we can test its effects? |
Yep! #4857 Edit: seems the dockerfile for composer 2.2.8 isn't quite ready yet so we'll need to wait on that. I'll check back in tomorrow |
Thanks @jurre! I'll follow that PR! |
Tested again once #4861 was included in a release but it is still timing out on our test repo. |
We have been having the same problem. Though these are WordPress setup with over 8 custom VCS repositories for private repositories. Locally, the update only takes 35.07s, but on Dependabot it is reaching the 45-minute limit. |
@grappler does it take 35 seconds locally if you start with an empty composer cache? |
The cleared the cache and ran the update command with the profile flag, and it took 74.2 seconds, which is still faster than the 45 minutes timeout.
|
Worth noting if dependabot is checking for updates to many packages it will do an update per package. So for a composer with 10 packages all with newer versions available it will take 72 seconds for each so more than 720 seconds |
Drupal now removed the replaced declaration in 9.4.4 so I expect it to run much quicker as no 404 requests clogging the network per package. But I haven’t tested it. We moved to only using dependabot for Drupal core packages and using Drupal itself to notify of module updates. Other composer packages tend to appear in Security tab when updates available. So I’ve been somewhat distanced from this issue |
I started learning about
While it's not a near-term priority for us, it'd be nice to move from using composer as a library with native PHP helper code etc to instead using it as a CLI with various flags to extract the information we need... it lets us preserve the native package manager abstraction a lot better. We moved toward this in the |
There's no caching dependabot side but I'm not sure what can be cached. Each update is separate and independent and so needs resolving on its own. Everything caching wise would be composer.
Not quite the same as the library method allows specifying custom installers etc. so that Dependabot can prevent any writes or downloads of actual packages. Additionally, to use the CLI, because composer allows deep integrations like composer-patches extension and wikimedia-composer-merge extension it would immediately break because those would attempt to access repository data referenced in the composer.json, such as a patches file, custom extensions from the code base itself, or other composer.json files from downloaded and extracted packages. So you'd soon find you need to not only copy in the composer.json/composer.lock for the run but the entire repository as there's no way to tell what files will be accessed.
As noted the CLI doesn't let you stop downloads or installs. It's not intended nor do I think it ever will be implemented to allow the CLI to be run in a way that doesn't actually install or update, and only updates the lock files. So using the CLI will make things slower. The only way I can think to make things quicker would be to, as you say, update everything at once. As that involves only one round trip to the repository then and one single resolution of package dependencies. That's a very different architecture to what dependabot uses currently. I think the difference between the |
Thanks, that's extremely helpful context. I had seen that a We worked around some of these issues in I'm going to icebox this CLI migration idea for now... may run some experiments at some point just to see if any other way to do it... I still can envision where the For now though, I'm afraid this won't be a priority given your insights into the difficulties of trying to leverage straight CLI commands. |
The dry run I think wouldn’t help - composer bump is just a way of saying “the lock has 1.2.1 but the requirement was ^1.0, increase the requirement to require what’s locked in so the minimum version is increased, ie ^1.2.1” the dry run just outputs what would be changed in the requirements. No actual check for updates is done it’s just a way of telling composer AFTER an update “ok so now you updated - now make this version the new minimum”. Tbh never been able to understand the need but hey lots of sue cases around these things! |
Thanks! Appreciate you clarifying. |
Still getting random timeouts against 45 minutes. |
Hello there, is this still happening? We've shipped a lot of perf improvements and want to be sure this has improved. |
Getting this message at end of logs, on more than one occasion, please advise. We are on Dependabot (not preview) and have seen this on more than one occasion now so I figured I'd open an issue.
The link that says "learn more" links to https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically.
Package manager/ecosystem
composer
Manifest contents prior to update
Updated dependency
What you expected to see, versus what you actually saw
Expect Dependabot not to timeout.
Images of the diff or a link to the PR, issue or logs
The text was updated successfully, but these errors were encountered: