lando / laravel

The Official Laravel Lando Plugin
https://docs.lando.dev/laravel/
GNU General Public License v3.0
14 stars 11 forks source link

MySQL never launches with Laravel Recipe (Assertion failure) #64

Closed faustbrian closed 1 month ago

faustbrian commented 2 months ago

I'm on a freshly installed macOS Sonoma 14.5 with the latest Docker Desktop. Whenever I run lando start or lando rebuild -y the MySQL server never seems to finalize booting. The error that pops up is [InnoDB] Assertion failure: log0recv.cc:1982:!page || (ibool) !!page_is_comp(page) == dict_table_is_comp(index->table) thread 140737052129024 which seems to be a corruption of the database but the database should be empty at that point because no migrations have been run yet. The machine itself doesn't run any kind of databases outside of Lando, so there shouldn't be any conflicts or issues that could arise from that.

Error

  ⚠ The service "database" failed its healthcheck
    Failed with mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'database' (111)

lando logs -s database

database_1  | 2024-07-12T05:43:12.315706Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld (mysqld 8.0.19) starting as process 155
database_1  | 2024-07-12T05:43:12.326860Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
database_1  | 2024-07-12T05:43:12.326968Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
database_1  | 2024-07-12T05:43:13.880448Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: log0recv.cc:1982:!page || (ibool) !!page_is_comp(page) == dict_table_is_comp(index->table) thread 140737052129024
database_1  | InnoDB: We intentionally generate a memory trap.
database_1  | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
database_1  | InnoDB: If you get repeated assertion failures or crashes, even
database_1  | InnoDB: immediately after the mysqld startup, there may be
database_1  | InnoDB: corruption in the InnoDB tablespace. Please refer to
database_1  | InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
database_1  | InnoDB: about forcing recovery.
database_1  | /opt/bitnami/scripts/libos.sh: line 177:   155 Aborted                 "$@"

my.cnf

[mysqld]
innodb_buffer_pool_size=1G
innodb_force_recovery=1
max_allowed_packet=1G
net_read_timeout=600
net_write_timeout=600
wait_timeout=600

.lando.yml

name: api
recipe: laravel

config:
    cache: redis:7
    config:
        database: .lando/my.cnf
        php: .lando/php.ini
        vhosts: .lando/nginx.conf
        cache: .lando/redis.conf
    database: mysql:8.0
    php: '8.1'
    ssl: false
    via: nginx
    webroot: public
    xdebug: true

excludes:
    - node_modules

proxy:
    appserver_nginx:
        - api.lndo.site
    gotenberg:
        - api-gotenberg.lndo.site:3000
    mailhog:
        - api-mailhog.lndo.site
    phpmyadmin:
        - api-phpmyadmin.lndo.site

services:
    appserver:
        type: php:8.1
        ssl: true
        sslExpose: false
        build_as_root:
            - apt-get update -y
            - apt install nano
            - apt install libxslt1-dev -y
            - apt-get install libtidy-dev -y
            - apt-get install build-essential -y
            - apt-get install make -y
            - apt-get install imagemagick -y
            - docker-php-ext-install tidy
            - docker-php-ext-install xsl
            - apt-get install cron -y
            - service cron start
        build:
            - cp -f .env.example .env
            - composer install
            - php artisan storage:link
        run_as_root:
            - service cron start
        run:
            - sed 's/ //g' /app/.lando/cron.txt | crontab -
        overrides:
            depends_on:
                - database
    cache:
        portforward: true
    database:
        portforward: true
    gotenberg:
        type: lando
        ssl: true
        sslExpose: false
        scanner:
            path: /health
        services:
            image: gotenberg/gotenberg:8
            ports:
                - 3000
            command: gotenberg
    horizon:
        type: php:8.1
        via: cli
        scanner: false
        command: 'php artisan horizon'
        overrides:
            restart: always
    mailhog:
        type: mailhog
        ssl: true
        sslExpose: false
        hogfrom:
            - appserver
    node:
        type: node:20
        build:
            - npm ci
    phpmyadmin:
        type: phpmyadmin:5.1
        ssl: true
        sslExpose: false
        hosts:
            - database
    redis:
        type: redis
        portforward: true
AaronFeledy commented 2 months ago

If you've ever started even an incomplete app with the same name, a data volume may already exist that it's trying to use. Try running lando destroy to wipe out the data volumes associated with this app.

Also, try narrowing the scope of the issue by starting with just the laravel recipe with no additional configuration to make sure that you can run that. Then add your additional configurations piece by piece, running lando destroy before each start until you find which part breaks things.