| Comment | File | Size | Author |
|---|---|---|---|
| #53 | backup_migrate-n2946311-53.patch | 1.16 KB | damienmckenna |
| #37 | backup_migrate-n2946311-37.patch | 610 bytes | damienmckenna |
| Comment | File | Size | Author |
|---|---|---|---|
| #53 | backup_migrate-n2946311-53.patch | 1.16 KB | damienmckenna |
| #37 | backup_migrate-n2946311-37.patch | 610 bytes | damienmckenna |
Comments
Comment #2
k.elizabeth commentedI wanted to clarify that this is happening for some, but not all, sites that we manage that backup both Drupal and CiviCRM databases. Which makes this especially confusing.
Comment #3
damienmckennaYou might try out the setting that lets you use the mysqldump command directly, see if that helps.
Comment #4
k.elizabeth commentedI'm not seeing that option anywhere in 7.x-3.3, could you direct me to it?
Comment #5
damienmckennaThe option is on the profile edit form, it's under Advanced Options, "Use cli commands".
Also, make sure you're using 3.5.
Comment #6
couturier commentedComment #7
k.elizabeth commentedI am using 3.5, and have selected 'Use cli commands'. When I run cron, I still get the 'Too many connections' message.
As that runs, I check the connections. They go up and up until it hits the limit (I have max_connections at 500 for testing this) then the job errors out as you see above.
After that cron job fails, the connections drop back down:
Ran it again, this time looking at the actual processes. Most of them are sleeping. (Too big to post here, would put it in a pastebin, but do not want to share client info). Here is a sample:
I try checking a different site we manage, on a different server. bam has been updated to 3.5. Backups are (thankfully) running, but max_connections is set at 350. When I attempt to access any of the bam settings pages, I get:
And then it fails once it hits 350 (the max_connections setting). This is when I attempt to navigate to the main settings tab, saved backups tab, and schedules tab.
We're concerned that something was introduced in the 3.4 update that is causing this, These two sites I am working with are samples. We are having the same trouble across all of our sites (~20+) that use bam for scheduling backups for both drupal and civi.
Comment #8
k.elizabeth commentedComment #9
k.elizabeth commentedComment #10
k.elizabeth commentedJust an update to share what I get when I roll backup_migrate back to 3.3 and run cron with drush (all the backups were backlogged because cron was unable to successfully run them when using 3.5):
All of these backups ran without connections exceeding 150. This used precisely the same backup settings, as I have them saved as a feature.
Also, all of the settings pages load relatively quickly (rather than timing out as they do with 3.5).
Comment #11
couturier commented@DamienMcKenna, correct me if I'm wrong, but I think 7.x-3.4 was the first release after the long gap of time when Ronan quit working on the module and Alex Andrascu and team had taken over. This could make the problem's origin hard to trace if it was something Ronan may have worked on in the 3.4 dev that wasn't necessarily documented in the issues queue. This wasn't a problem in 3.3 but emerged in 3.4, and oddly not on all sites using CiviCRM but only some of them.
@k.elizabeth, is there any other common factor among the sites with this issue that you could isolate?
Comment #12
k.elizabeth commentedI can confirm after leaving 3.5 on a few drupal/civi sites for some time, that though backups have continued successfully completed in some of these cases, in all cases we are seeing an overload to mysql connections whenever backup migrate runs. We are now having to roll back all of our sites to 3.3 to alleviate the issue.
The only common factor for this problem is that we are running backups for both Drupal and Civi. Another common factor may be the volume of backups: thrice daily civi, thrice daily drupal, daily civi, daily drupal, weekly drupal, weekly civi. Of course these do not all run at once, they run at different times in the day. All sites are using Drupal cron.
All of our sites that only run Drupal backups are handling fine, though we have not tested if there is a significant increase in connections for those sites as it has not been a top priority for us to date.
Comment #13
couturier commentedThanks for the additional information @k.elizabeth. I searched the issues queue for anything filed against 7.x-3.3 specifically that might have been changed with the upgrade to 3.4 to induce a "too many connections" error, and nothing is relevant.
However, there is an interesting comment by Ronan in the following thread that indicates he was working on something related to multiple sources for backups in the 3.x branch. This makes me wonder if he changed something in the 3.x dev after 3.3 was released that would have affected the connections when 3.4 was finally put out by a different team of programmers: https://www.drupal.org/project/backup_migrate/issues/1305716
If we can't find a historical reference for something that changed between the 3.3 and 3.4 versions to have caused your error, then we'll have to tackle this problem fresh. I'm also curious if you are planning to move your sites to Drupal 8 at any point in the near future. 7.x-3.3 might work well enough for you to continue until your upgrades to D8 if this ends up being a time-consuming and mysterious problem to fix. Thanks!
Comment #14
k.elizabeth commentedThanks for the follow-up, and looking forward to hear what you find out.
We have no present intention to migrate any of these sites to Drupal 8. As of now, our plan is to migrate all existing Drupal 7 sites to Backdrop over time. We only have two sites in Backdrop presently, and both use the ported backup_migrate module.
Comment #15
couturier commentedThat's interesting you're moving to Backdrop. So, I'm assuming the ported backup_migrate for Backdrop the home page for which I just viewed here is now on its own maintenance track including new version numbers and wouldn't benefit from any fix we might find for the 7.x-3.x Drupal version. Or, do module upgrades and fixes get re-ported to Backdrop when upgrades occur for the Drupal version?
My recommendation for now would be to continue using 7.x-3.3 for your sites until they are all moved to Backdrop. The reason for that is due to extremely limited resources for the Backup and Migrate module right now and also due to lack of any prior documentation as to what may have introduced this error starting with 7.x-3.4. Most of the development effort for this module is being focused on getting a stable Drupal 8 release. However, let's leave this issue open for now and see if we have anyone else reporting the same error. I'm not sure if something in your local environment could be contributing, so if we can find other users duplicating the error, that would help.
Comment #16
k.elizabeth commentedI will note that this is happening on array of VPS and shared hosting environments, not in a single environment, and not all of which we provide systems administration for.
Comment #17
k.elizabeth commentedComment #18
couturier commentedThanks for the additional information. It must be something in the Backup and Migrate module that changed from 7.x-3.3 to 3.4 that is the problem, then.
Comment #19
couturier commentedCorrection to previous comments: the official releases page shows that 7.x-3.3 was released on October 18, 2017, and was the second release for 7.x under Alex Andrascu after Ronan took leave from the project. 7.x-3.4 was released on January 24, 2018. The list of commits between those two dates include numerous fixes, but one in particular stands out to me that might have caused the "too many connections error" you experienced starting with 3.4, as follows:
The reason this patch might be relevant is that the reporter had multiple scheduled backups from multiple sources. I don't have the experience to be able to look into the code to see if anything happened with this fix to cause the new error, but if someone could help out with that, I think it is at least a starting point. If this commit checks out okay, then I would recommend going back to the full commit list mentioned above and looking at the other issues between the two release dates to see if anything else might have changed.
@k.elizabeth, I'm still curious if ongoing fixes within Backup and Migrate 7.x on Drupal are moved over to Backdrop or if the two projects have completely diverged at this point. Thanks.
Comment #20
k.elizabeth commentedThanks for the follow up, this is all useful information. We ourselves have multiple scheduled backups from multiple sources and multiple destinations, and do not experience the issue outlined in issue #2742855 when we are using 7.x-3.3, for what it's worth.
Our solution for now has been to roll all of our sites back to 7.x-3.3, check that the security issue fixed in 7.x-3.4 does not apply to our sites, and set the .info file to claim 7.x-3.5 in order to keep our monitoring system (and our clients) from being alerted to the out-of-date module. Thank goodness for features allowing us to save all of our backup settings! This is a band-aid for us, but we would love to see a 7.x-3.6 release that rolls back whatever commit is causing this issue.
As for Backdrop, the backup_migrate module is being maintained by Jason Ramsey, and as far as I can tell from the release notes, it has diverged from the D7 backup_migrate module.
Comment #21
couturier commentedThanks for the info on the Backup and Migrate module diverging for Backdrop. So, fixing this current here isn't going to affect that code, then.
Per your suggestion, I wonder if someone could manually roll back the #2742855 commit and see if it solves the problem. I understand that you aren't having the same issue, but it is the only commit i see within the time frame we've narrowed down that has anything even remotely related to your current issue as far as the elements of code that were being addressed.
As I also mentioned in Comment #19, there is a pretty narrow list of commits between the two dates that are the timeframe for this error having been created. if rolling back #2742855 doesn't work, then it's not beyond possible to test the other commits individually.
Comment #22
Cyberflyer commentedSome data for the maintainers:
I'm running Drupal 7.58, Commons 7.x-3.47 and CiviCRM 7.x-4.7.31 on my client's site.
Hosting is running Apache 2.4.29, PHP 7.0.28, MySQL 10.1.32-MariaDB on linux kernal 2.6.32-896.16.1.lve1.4.49.el6.x86_64.
The Status page is a green board. Everything is reporting operating and latest revisions, etc.
I installed Backup and Migrate 7.x-3.5.
I created Sources for my Drupal DB, CiviCRM DB and Site Root Files Folder.
I set up destinations for Node Squirrel, and manual and scheduled server locations at ../drupal-backup/manual and ../drupal-backup/scheduled, respectively.
I created a Settings for my site, storing structure only for cache tables.
When I go to the B&M main admin page, I get "Quick Backup" and it works.
When I go to the Node Squirrel tab, it comes up and tells me the status of NS.
When I go to Schedules tab, it shows me one NodeSquirrel schedule, which is disabled.
However, when I go to the Settings tab I get a simple page titled "Error" with the helpful note that:
Makes me suspect permissions, but they seem proper.
Looking at recent Log messages, I see this:
I ran a cron and it produced this message:
I'm hoping this is useful in debugging this issue.
Let me know if there is something I should try....
Comment #23
damienmckennaI wonder if the fact that you have CiviCRM connecting to it too is compounding the problem? I really don't know..
Comment #24
couturier commented@Cyberflyer was everything working well for you with the 7.x-3.3 release? As per comments above, there was something starting with the 7.x-3.4 release that caused the max connections issue, and there is a limited list of commits during that timeframe that could have introduced the problem. It would be great if we could roll back #2742855 in particular and see if it solves your problem. CiviCRM could indeed be compounding the problem, but if so, it's strange that the 7.x-3.3 release works fine for many sites even with CiviCRM.
Comment #25
k.elizabeth commentedI would look forward to any rollback of commits that could potentially be related to the max_connections issue. I would be happy to test a dev release with such rollbacks and report on the results!
Comment #26
couturier commented@k.elizabeth and @Cyberflyer Can either of you help with this? We need someone to rollback the specific commit mentioned on the current release and re-test with your CiviCRM systems. Not a lot of contributors are helping with Backup and Migrate as far as writing and testing because so many of the larger sites have moved to alternate backup methods beginning with Drupal 8. It would be a great help if those of you that this error is affecting could rollback and test with your systems. If the commit mentioned has no effect, then previous comments explain how to find the half dozen or so other commits that could be the culprit.
Comment #27
couturier commentedThis is fairly interesting that another user is having the same issue without using CiviCRM. We're still needing help with rolling back the commit and testing since the module works fine for most of us, so we wouldn't be able to see whether that certain commit or others within the time frame may have caused the issue. Can anyone who is having this error help with testing?
Comment #28
k.elizabeth commentedI will try to find some time in the next couple of weeks to roll back commits and test; I will update here with the results once I do.
Comment #29
damienmckennaComment #30
sharonknieper commentedI too am seeing this issue on a Drupal/Civicrm site. The behavior I see is as k.elizabeth describes with the ability to make a manual backup just fine however trying to go to the settings page results in the following error:
"PDOException: SQLSTATE[HY000] [1203] User {database username} already has more than 'max_user_connections' active connections in backup_migrate_source_db->_get_db_connection() (line 223 of /sites/all/modules/backup_migrate/includes/sources.db.inc)."
I noticed the error when using 7.x-3.5 and tried reversing the changes in #2742855 per this thread, upgrading to the recently released 7.x-3.6, and downgrading to 7.x-3.3. None of these changes fixed the issue.
However, I did notice that if I removed the line defining the civicrm database from the 'backup_migrate_sources' mysql table I was then able to access the settings page. So I removed the source, profile and scheduled backup associated with the civicrm database. Once I added the source for the civicrm database back again I am no longer able to access the schedules page nor the settings page url (admin/config/system/backup_migrate/settings). Though if I directly visit the source settings url (admin/config/system/backup_migrate/settings/source) it does not cause the error.
I also made a new mysql user with permissions on the civicrm database only for creating a backup and migrate source but it still throws the error that there are too many connections.
I'm not sure how to debug this further but I am willing to test ideas if anyone has any.
The site doesn't have plans to move to D8 soon so a fix in 7x would be greatly appreciated.
Comment #31
couturier commented@sharonknieper Thank you so much for taking time to do the testing and reporting back. Our original users involved in this issue never got back with us, so this issue had been shelved for a long time. I find it impressive that you reverted to 7.x-3.3 and were still having the problem since the previous user said that everything was working fine in that version and only changed upon moving to 3.4. So, that tells us that it's probably not related to any upgrades to the module during that time and may be another issue or combination of issues that are more complex. We'll see if anyone else can help or comment on your findings.
Also, on the topic of not planning to upgrade to Drupal 8, I know a lot of sites seem to be stuck between the huge changes that were introduced with D8 and what they consider to be a workable arrangement with D7. It does concern me what will happen once D7 is no longer supported upon release of D9. There have been a few users moving to BackDrop CMS which is a fork of D7 that will hopefully be maintained for longer than D7 itself. There are pros and cons, and I've seen discussion of porting Backup and Migrate into BackDrop but have no idea if that's proceeding at this point.
Comment #32
nelslynn commentedI can confirm I also get this error with Drupal 7 and CiviCRM. I also need to increase my PHP memory and Maximum execution time of 30 seconds or I get the following when I run /update.php then browse back to the home page:
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /home/mysite/public_html/includes/menu.inc on line 3799and/or
PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home/mysite/public_html/includes/database/database.inc on line 2227Comment #33
damienmckenna@nelslynn: If your Drupal 7 site is giving out-of-memory errors loading the homepage when the memory limit is set to 512mb there's definitely room for improvement on your site and/or server, completely unrelated to Backup Migrate.
Comment #34
couturier commentedThere were 4 new releases of CiviCRM during the time period in question when the error began occurring for our earlier posters. It would be interesting to know which version of CiviCRM they were using in combination with Backup and Migrate 7.x-3.3 that allowed things to go smoothly. I am wondering if any changes to CiviCRM affected the interaction starting with Backup and Migrate 7.x-3.4 or if we are dealing with something much more complex than software changes -- perhaps the local environment as Damien McKenna suggested.
Comment #35
nelslynn commentedMy issue has been resolved. I did a couple things related to CiviCRM that may have helped resolve the issue:
- Converted Datetime fields to Timestamps
- Changed php version to 7.1
Thanks for all the help.
Comment #36
jackalope commentedFrom @couturier on update #26 on this issue: "@k.elizabeth and @Cyberflyer Can either of you help with this? We need someone to rollback the specific commit mentioned on the current release and re-test with your CiviCRM systems."
I think I was finally able to do this myself, though not specifically via git. Here's how:
https://www.drupal.org/files/issues/2742855-n4.patch is the patch that causes the changes to includes/profiles.inc that then result in this "Too many connections" error.
I downloaded and reverted https://www.drupal.org/files/issues/2742855-n4.patch against
backup_migrate-7.x-3.6; reverting that patch resolved the error.That patch is connected to Drupal.org issue https://www.drupal.org/node/2742855, which was fixed by this commit: https://www.drupal.org/commitlog/commit/4484/0954938cedcd37f4559d035892d...
So rolling back commit 0954938cedcd37f4559d035892dc71e20e7fcc25 should fix the problem.
If y'all definitely need someone with an affected site to clone the backup_migrate git repo, roll back that specific commit and test again, let us know, we should be able to make that happen sometime soon!
Comment #37
damienmckennaI've looked this over. I think we need to revert the original change and then work out when the static variable needs to be cleared. In #2742855: Caching profile objects led to unwanted behaviours because of stale data hanoii said that problems happened when multiple scheduled tasks were conflicting, so maybe the profile static variable should be cleared after each backup execution?
Comment #38
rrirower commentedI've also begun to see this problem.
It occurred after I had added a new source and profile. I then tried to add a schedule and the above message now appears. For giggles, I tried the posted patch and it did not work. The database I am trying to back up is a non-Drupal database within PHPMyAdmin.
Is there any way for me to remove the source and profile I've already defined?
Is this close to being fixed?
Comment #39
jackalope commented@rrirower, Did you try applying https://www.drupal.org/files/issues/2742855-n4.patch, or some other patch? If you tried applying that patch, you need to instead revert it!
Here are the commands I used to download and revert that patch, which fixed this problem for me:
Comment #40
jackalope commentedUgh sorry @rrirower, I realize you probably meant you tried applying https://www.drupal.org/files/issues/2019-02-06/backup_migrate-n2946311-3... that Damien recently posted; I've not yet tested that patch myself!
Comment #41
rrirower commentedjackalope,
Yes, that was the patch. I've already reverted it.
Comment #42
jackalope commentedI tested @DamienMcKenna's patch in comment #37 above by reverting my patch-reversion-fix documented in my earlier comment #36, then applying the new patch instead. The scheduled backups that were triggering the "Too many connections" error have continued to work just fine, so I'd say the patch works, at least for the problem we're experiencing! (I can also see that the new patch is basically a reversion of https://www.drupal.org/files/issues/2742855-n4.patch so I'm not surprised it works!)
Comment #43
damienmckennaThanks @jackalope.
The next step is to work out what items need to be cleared to avoid the bug reported in #2742855: Caching profile objects led to unwanted behaviours because of stale data that caused this problem in the first place.
Comment #44
couturier commented@jackalope I really appreciate your finally doing this testing and finding the commit that was the culprit. Thanks for your contribution. It's good to know this was a change in Backup and Migrate rather than something that changed within CiviCRM at the time.
Comment #45
Anonymous (not verified) commentedI have just hit the same problem.
Drupal 7.63. Backup & Migrate 7.x-3.6. PHP 7.2.11. CiviCRM 5.9.1.
Tony
Comment #46
jackalope commentedThanks for the thanks @couturier and @DamienMcKenna, happy to help!
Comment #47
couturier commentedI'm setting this back to needs work because now we have two issues here, the original patch which fixed a caching/stale data issue but then created this second issue of "too many connections" for CiviCRM users. Damien McKenna has suggested that we go back and re-work the original patch that caused the problem.
Comment #48
katharine_gates commentedCan confirm I am also having this problem with a combination of a Drupal and a Civi database.
Backup and Migrate 7.x-3.6, civicrm 7.x-5.10.3
All worked fine setting up scheduled backups for default database, but when I attempted to set up scheduled backups for Civi database, got this nasty error and wsod. Now I am unable to access either /admin/config/system/backup_migrate/settings or /admin/config/system/backup_migrate/schedule to even fix it!!
Can anyone give me a clue where to go in database to at least clear this up so we can reset??
Comment #49
bmango commented@Katharine_Gates, you could try simply uninstalling Backup and Migrate, and then reinstalling a previous version. I don't think uninstalling the module will remove any of your backups.
Comment #50
katharine_gates commentedThank you bmango but unfortunately we have a bunch of Features modules (I am picking up from another developer, ugh!) that require B&M and they all seem to be circularly requiring each other. I can disable the Civi Source and that fixes it, but it sure would be nice to be able to backup Civi on a schedule!
Comment #51
bmango commentedYou can still backup the Civi database on a schedule by using a bash script and then use cron to execute the script on a regular basis. I answered a similiar question on this in stack exchange and gave an example of a script you can use.
I was having the same problem as you backing up my Civi db and so I used a script to back it up instead of Backup and Migrate. I just use Backup and Migrate to backup the Drupal db.
Comment #52
jackalope commentedHi @Katharine_Gates -- until this problem is fixed in an official release of the module, you can try applying the patch posted at the top of this ticket to your site's copy of backup_migrate. Check out the Drupal documentation on applying patches for help on how to do it; here are the commands I run from my Drupal root directory to download and the patch to my
$DRUPAL_ROOT/sites/all/patchesdirectory and apply it to my module in$DRUPAL_ROOT/sites/all/modules/backup_migrate:And hopefully someone gets to tackle the work outlined in update #47 above soon so that the fix makes it into the module itself!
Comment #53
damienmckenna@jackalope: Thank you so much for providing those instructions, I really appreciate the help.
A minor reroll and adjustments to comments.
Comment #54
damienmckennaComment #55
jackalope commentedThe reroll in #53 has worked properly for me!
Comment #56
damienmckennaComment #57
damienmckennaComment #58
damienmckennaCommitted. Thank you all.