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

Unable to override mysql max_allowed_packet setting #894

Closed
jeffsheltren opened this issue May 30, 2018 · 3 comments
Closed

Unable to override mysql max_allowed_packet setting #894

jeffsheltren opened this issue May 30, 2018 · 3 comments
Assignees
Milestone

Comments

@jeffsheltren
Copy link
Contributor

jeffsheltren commented May 30, 2018

Describe the bug
I am following instructions on https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/ to override mysql settings using a custom .cnf file. I am able to override some settings, but I'm unable to override max_allowed_packet specifically, even when other settings in the override file are being applied successfully.

To Reproduce
Steps to reproduce the behavior:

  1. Create a ddev environment
  2. Login to mysql (ddev ssh followed by mysql -u root -proot -h db)
  3. Check settings for max_allowed_packet (and other settings to verify they are later overridden -- for example, both tmp_table_size and max_heap_table_size default to 64M, those will be overridden as a test).
mysql> show global variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.01 sec)

mysql> show global variables like 'tmp_table_size';
+----------------+----------+
| Variable_name  | Value    |
+----------------+----------+
| tmp_table_size | 67108864 |
+----------------+----------+
1 row in set (0.00 sec)

mysql> show global variables like 'max_heap_table_size';
+---------------------+----------+
| Variable_name       | Value    |
+---------------------+----------+
| max_heap_table_size | 67108864 |
+---------------------+----------+
1 row in set (0.01 sec)
  1. Add a custom cnf file within .ddev/mysql/foo.cnf with the following contents:
[mysqld]
max_allowed_packet=32M
tmp_table_size=128M
max_heap_table_size=128M
  1. Run ddev restart, verify the new cnf file is being loaded with the following output: Using custom mysql configuration: [foo.cnf].
  2. Login to mysql again and check settings for the above overridden variables. While some will be overridden successfully, max_allowed_packet remains at the default 16M:
mysql> show global variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)

mysql> show global variables like 'tmp_table_size';
+----------------+-----------+
| Variable_name  | Value     |
+----------------+-----------+
| tmp_table_size | 134217728 |
+----------------+-----------+
1 row in set (0.00 sec)

mysql> show global variables like 'max_heap_table_size';
+---------------------+-----------+
| Variable_name       | Value     |
+---------------------+-----------+
| max_heap_table_size | 134217728 |
+---------------------+-----------+
1 row in set (0.00 sec)

Expected behavior
max_allowed_packet should be overridden with the value from foo.cnf.

Version and configuration information (please complete the following information):

  • mac OS 10.13.4
  • Docker version 18.03.1-ce
  • ddev version:
db    	drud/mariadb-local:v0.9.0
dba   	drud/phpmyadmin:v0.2.0
router	drud/ddev-router:v0.5.1
commit	v0.18.0
domain	ddev.local
cli   	v0.18.0
web   	drud/nginx-php-fpm-local:v1.3.0
  • config.yaml contents for the misbehaving project:
APIVersion: v0.18.0
name: foo
type: drupal7
docroot: docroot
php_version: "5.6"
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
provider: default


# This config.yaml was created with ddev version v0.18.0
# webimage: drud/nginx-php-fpm-local:v1.3.0
# dbimage: drud/mariadb-local:v0.9.0
# dbaimage: drud/phpmyadmin:v0.2.0
# However we do not recommend explicitly wiring these images into the
# config.yaml as they may break future versions of ddev.
# You can update this config.yaml using 'ddev config'.

# Key features of ddev's config.yaml:

# name: <projectname> # Name of the project, automatically provides
#   http://projectname.ddev.local and https://projectname.ddev.local

# type: <projecttype>  # drupal6/7/8, backdrop, typo3, wordpress, php

# docroot: <relative_path> # Relative path to the directory containing index.php.

# php_version: "7.1"  # PHP version to use, "5.6", "7.0", "7.1", "7.2"

# You can explicitly specify the webimage, dbimage, dbaimage lines but this
# is not recommended, as the images are often closely tied to ddev's' behavior,
# so this can break upgrades.

# webimage: <docker_image>  # nginx/php docker image.
# dbimage: <docker_image>  # mariadb docker image.
# dbaimage: <docker_image>

# router_http_port: <port>  # Port to be used for http (defaults to port 80)
# router_https_port: <port> # Port for https (defaults to 443)

# xdebug_enabled: false  # Set to true to enable xdebug and "ddev start" or "ddev restart"

additional_hostnames:
# - someothername
# would provide http and https URLs for "somename.ddev.local"
# and "someothername.ddev.local".

# provider: default # Currently either "default" or "pantheon"
#
# Many ddev commands can be extended to run tasks after the ddev command is
# executed.
# See https://ddev.readthedocs.io/en/latest/users/extending-commands/ for more
# information on the commands that can be extended and the tasks you can define
# for them. Example:
#hooks:
#  post-import-db:
#    - exec: "drush cc all"

hooks:
  post-start:
    # Enable ping within Solr so that Drupal acknowledges it is up and running.
    - exec: "curl -s http://foo.ddev.local:8983/solr/dev/admin/ping?action=enable -o /dev/null"
@rfay
Copy link
Member

rfay commented May 30, 2018

Thanks so much for the great bug and description. PR should fix it, you can check it out using the testing instructions in #895

Do you think 16M is good enough in general for our default config, or should we also raise that in the config?

@jeffsheltren
Copy link
Contributor Author

Thanks @rfay for the quick fix!

Since max_allowed_packet memory is only allocated as it's used, it's safe to set the default to something much higher to help people avoid "packet too large" errors. I'd suggest something like 256M, which should be plenty big enough for most users, and once this is available to override in a custom cnf file, people who hit issues at 256M could increase it even further. Reference: https://dev.mysql.com/doc/refman/5.7/en/packet-too-large.html

@rfay
Copy link
Member

rfay commented May 30, 2018

Added a commit to set the default to 256M, thanks!

rfay added a commit to rfay/ddev that referenced this issue May 30, 2018
@rickmanelius rickmanelius added this to the v0.19.0 milestone May 30, 2018
@rfay rfay closed this as completed in e30068c May 30, 2018
@dclear dclear removed the actionable label May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants