Skip to content
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

Restorations fail when using Socket instead of Localhost for DB #572

Closed
jessecowens opened this issue Dec 12, 2023 · 0 comments
Closed

Restorations fail when using Socket instead of Localhost for DB #572

jessecowens opened this issue Dec 12, 2023 · 0 comments

Comments

@jessecowens
Copy link
Member

Describe the bug
Platform InMotion servers use localhost:/var/lib/mysql/mysql.sock for the DB_HOST value, as the team identified the socket to be more performant than TCP/IP localhost. However, when using this host value, restorations fail due to a "No route to host" error.

To Reproduce
Steps to reproduce the behavior:

  1. Set the DB_HOST value in wp-config.php to the mysql socket path (reach out to Jesse on Platform i team if you need assistance replicating)
  2. Restore a backup file
  3. Note the following error in the restoration log:
[message] => Uncaught PDOException: SQLSTATE[HY000] [2002] No route to host in /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-db-import.php:154
Stack trace:
#0 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-db-import.php(154): PDO->__construct('mysql:host=loca...', 'wordpress', 'arTSbUdobApzWWw')
#1 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-db-import.php(102): Boldgrid_Backup_Admin_Db_Import->import_lines(Array)
#2 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-core.php(1317): Boldgrid_Backup_Admin_Db_Import->import('/home/wordpress...')
#3 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-core.php(2565): Boldgrid_Backup_Admin_Core->restore_database('/home/wordpress...', 'wp_', NULL)
#4 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/includes/class-boldgrid-backup-restorer.php(200): Boldgrid_Backup_Admin_Core->restore_archive_file()
#5 /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-core.php(3069): Boldgrid_Backup_Restorer->run()
#6 /home/wordpress/doc_root/wp-includes/class-wp-hook.php(324): Boldgrid_Backup_Admin_Core->wp_ajax_restore('')
#7 /home/wordpress/doc_root/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#8 /home/wordpress/doc_root/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /home/wordpress/doc_root/wp-admin/admin-ajax.php(188): do_action('wp_ajax_boldgri...')
#10 {main}
  thrown
    [file] => /home/wordpress/doc_root/wp-content/plugins/boldgrid-backup/admin/class-boldgrid-backup-admin-db-import.php
    [line] => 154

Expected behavior
The database should be able to restore regardless of whether the localhost or socket is used for DB connections.
Additionally, no failure message is presented to the user when the restoration fails, see #568

jessecowens added a commit that referenced this issue Dec 12, 2023
Copied the get_connection_string function from db-dump and update PDO connections to use the new function. Resolves #572
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant