Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Pytest runs very slow or not at all in local docker env (m1 apple) #628

Open
ugotsoul opened this issue Jun 2, 2021 · 3 comments
Open
Labels
developer-experience Stuff to make our lives as developers more pleasant

Comments

@ugotsoul
Copy link
Contributor

ugotsoul commented Jun 2, 2021

On a recent run that seemed to freeze right at the testing phase and I had to exit docker:

time docker exec -it vial pytest
0.19s user 0.16s system 0% cpu 14:10.57 total
@ugotsoul ugotsoul added the developer-experience Stuff to make our lives as developers more pleasant label Jun 2, 2021
@ugotsoul
Copy link
Contributor Author

ugotsoul commented Jun 2, 2021

I had one successful test run after restarting my containers like this: docker compose down && docker compose up --force-recreate in about 4-5 minutes.

The next run "worked but did not connect to the db, with these errors for every test:
ERROR core/test_admin.py::test_admin_export_csv - django.db.utils.OperationalError: server closed the connection unexpectedly

edit - including db errors from docker app:

database_1    | 2021-06-02 19:06:01.480 UTC [86] ERROR:  database "test_vaccinate" already exists
database_1    | 2021-06-02 19:06:01.480 UTC [86] STATEMENT:  CREATE DATABASE "test_vaccinate"
database_1    | 2021-06-02 19:16:55.474 UTC [78] PANIC:  stuck spinlock detected at LWLockWaitListLock, /build/postgresql-13-Wn5d1c/postgresql-13-13.3/build/../src/backend/storage/lmgr/lwlock.c:918
database_1    | qemu: uncaught target signal 6 (Aborted) - core dumped
database_1    | 2021-06-02 19:16:55.650 UTC [1] LOG:  server process (PID 78) was terminated by signal 6: Aborted
database_1    | 2021-06-02 19:16:55.650 UTC [1] DETAIL:  Failed process was running: SELECT "django_migrations"."id", "django_migrations"."app", "django_migrations"."name", "django_migrations"."applied" FROM "django_migrations"
database_1    | 2021-06-02 19:16:55.651 UTC [1] LOG:  terminating any other active server processes
database_1    | 2021-06-02 19:16:55.654 UTC [518] WARNING:  terminating connection because of crash of another server process
database_1    | 2021-06-02 19:16:55.654 UTC [518] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
database_1    | 2021-06-02 19:16:55.654 UTC [518] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
database_1    | 2021-06-02 19:16:55.659 UTC [68] WARNING:  terminating connection because of crash of another server process
database_1    | 2021-06-02 19:16:55.659 UTC [68] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
database_1    | 2021-06-02 19:16:55.659 UTC [68] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
database_1    | 2021-06-02 19:16:55.740 UTC [1] LOG:  all server processes terminated; reinitializing
database_1    | 2021-06-02 19:16:55.895 UTC [522] LOG:  database system was interrupted; last known up at 2021-06-02 19:14:28 UTC
database_1    | 2021-06-02 19:16:56.168 UTC [522] LOG:  database system was not properly shut down; automatic recovery in progress
database_1    | 2021-06-02 19:16:56.174 UTC [522] LOG:  redo starts at 0/E19D070
database_1    | 2021-06-02 19:16:56.466 UTC [522] LOG:  invalid record length at 0/EC85DB0: wanted 24, got 0
database_1    | 2021-06-02 19:16:56.466 UTC [522] LOG:  redo done at 0/EC85D78
database_1    | 2021-06-02 19:16:56.549 UTC [1] LOG:  database system is ready to accept connections

@ugotsoul
Copy link
Contributor Author

ugotsoul commented Jun 2, 2021

ah it's an qemu bug that happens when running Intel containers (amd64) on M1 chip (arm64): docker/for-mac#5122 (comment)

@ugotsoul
Copy link
Contributor Author

ugotsoul commented Jun 3, 2021

I subscribed to this issue about creating an arm64 builds for postgis: postgis/docker-postgis#216

Right now its faster and easier to push my changes and do a draft PR, than try to run tests on my m1 (which fails often). :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
developer-experience Stuff to make our lives as developers more pleasant
Projects
None yet
Development

No branches or pull requests

1 participant