[RUBY] MYSQL Lock TimeOut error I don't remember while running RSpec on the container

Give it to yourself in the past, which is too clumsy.

Cause

--Cause 1. When running the test on the container, debugging etc. was performed while stopping the execution with binding pry.

--Cause 2. Probably, ** the container is not stopped ** (it is stopped by binding pry), ** a new terminal is started and the test is executed again. ** **

--Cause 3. The containers are crowded, ** the state where multiple containers are trying to tamper with the table of the same DB due to the creation of test data etc. at the same timing **.

Image Screenshot 2020-06-13 16.32.25.png

――As a result, what was caused

Mysql2::Error::TimeoutError: Lock wait timeout exceeded

solution

--Check the list of running and stopped containers with docker-compose ps. Lots of undestroyed containers: scream:

--Delete the container with docker-compose kill target container. (Alternatively, if the test was run with docker-compose run --rm rspec etc., it will be automatically destroyed by docker-compose stop target container)

Commandments

Don't think you're too clumsy in the past, ** destroy the terminal without stopping the container and run the container in the new terminal. ** **

Recommended Posts

MYSQL Lock TimeOut error I don't remember while running RSpec on the container
I tried running Ansible on a Docker container
I get Mysql2 :: Error :: ConnectionError in the production environment
I tried running a Docker container on AWS IoT Greengrass 2.0