Error: Command failed with status 137

Hi Regis,

I upgraded to tutor version 3.7.2 and I get the following error when i run a quickstart:

        Database creation and migrations
================================================
Initialising all services...
docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml --project-name tutor_local exec mysql sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="jN7Tdtr4" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

mysql -u root --password="jN7Tdtr4" --host "mysql" --port 3306 -e 'CREATE DATABASE IF NOT EXISTS openedx;'
mysql -u root --password="jN7Tdtr4" --host "mysql" --port 3306 -e 'GRANT ALL ON openedx.* TO "openedx"@"%" IDENTIFIED BY "X5plm2Np";'
Initialising MySQL...
Warning: Using a password on the command line interface can be insecure.
MySQL is up and running
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Initialising lms...
docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml --project-name tutor_local exec lms sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
./manage.py lms --settings=tutor.production migrate

./manage.py lms --settings=tutor.production create_oauth2_client \
    "http://androidapp.com" "http://androidapp.com/redirect" public \
    --client_id android --client_secret yxzIfMKJH5se1POCNbmUHCXj \
    --trusted

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi
2019/10/09 15:47:05 Waiting for: tcp://mysql:3306
2019/10/09 15:47:05 Connected to tcp://mysql:3306
WARNING:py.warnings:/openedx/edx-platform/lms/djangoapps/courseware/__init__.py:5: DeprecationWarning: Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported
  warnings.warn("Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported", DeprecationWarning)

2019-10-09 15:47:35,226 WARNING 36 [enterprise.utils] utils.py:50 - Could not import Registry from third_party_auth.provider
2019-10-09 15:47:35,237 WARNING 36 [enterprise.utils] utils.py:51 - cannot import name _LTI_BACKENDS
Error: Command failed with status 137: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml --project-name tutor_local exec lms sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
./manage.py lms --settings=tutor.production migrate

./manage.py lms --settings=tutor.production create_oauth2_client \
    "http://androidapp.com" "http://androidapp.com/redirect" public \
    --client_id android --client_secret yxzIfMKJH5se1POCNbmUHCXj \
    --trusted

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

Please advise.
With best regards,
Cherie

Hi @CherieCAF! Docker containers stop with exit code 137 either when they are stopped (by docker stop for instance) or when they run out of memory: https://success.docker.com/article/what-causes-a-container-to-exit-with-code-137

How much RAM do you have?

My Total PhysMem is 16G :
PhysMem: 12G used (1968M wired), 4585M unused.

the CONTAINER tutor_local_cms_worker_1 and tutor_local_cms_1 always keep restarting.

After I tried it many times, the problem(failed 137) suddenly disappeared.
and the CONTAINER tutor_local_cms_1 is Up.

Hi,
Having the same trouble like yours.
How did you get over this?

Hi Regis,

I have 8GB and only half is used.

Could any of these warnings cause the error:

WARNING:py.warnings:/openedx/edx-platform/lms/djangoapps/courseware/__init__.py:5: DeprecationWarning: Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported
  warnings.warn("Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported", DeprecationWarning)

2019-10-09 15:47:35,226 WARNING 36 [enterprise.utils] utils.py:50 - Could not import Registry from third_party_auth.provider
2019-10-09 15:47:35,237 WARNING 36 [enterprise.utils] utils.py:51 - cannot import name _LTI_BACKENDS

Regards,
Cherie

Hi,

Still looking intio it.

I try again with Wsl2 and Docker for Wsl2.
It work very well. Think you should give it a try too.

Regis,

The lms container keeps restarting which seems odd. Additionally is it normal for CPU% to be >100%? Memory seems fine.

Regards,
Cherie

@CherieCAF I experienced a similar issue myself. Please try the following:

tutor local stop
tutor local start

Please paste here any error coming out of the lms container.

Hi Regis,

The tutor local stop and start didn’t work but I upgraded to 3.7.3, deleted the mysql data and the mongodb data and everything seems to function properly now.

Tkx for your help.

Regards,
Cherie

I had the same problem while Tutor was migrating Mongo data. I have a 8GB server, and because 137 = (128 + 9) SIGKILL for memory, I added swap space. This solved the problem for me.

cd /var
sudo touch swapfile
sudo chmod 600 swapfile
sudo ls -la swapfile

16000 = 16GB:

sudo dd if=/dev/zero of=/var/swapfile bs=1024k count=16000
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
sudo swapon -show

This will use up an extra 16GB of disk space, and it should not be ready. Probably try 8000 for another 8GB instead.

To permanently add swap space, do this:
sudo vi /etc/fstab
(OR: sudo nano /etc/fstab)
Add this line to the file:
/var/swapfile none swap sw 0 0

And save the file. When your system reboots, the swap will still be there.

If you want to remove the swap later on:
sudo swapoff /var/swapfile
sudo rm /var/swapfile
sudo vi /etc/fstab
Remove the line: /var/swapfile none swap sw 0 0
Save the file.

Hope this works for you as it did for me.

1 Like