Switched from WSGI to ASGI for Django Channels and now CircleCI throws "corrupted double-linked list" even though tests pass

Question:

I’ve been working on a project which requires WebSockets. The platform is built with Django and was running the WSGI server gunicorn. We decided to implement WebSockets using Django Channels.

I set everything up including switching from gunicorn to the ASGI server daphne. Everything works great in local development environment. Deployment to AWS is working and everything works great on dev/staging. pytest works and all tests pass locally. On CircleCI all the tests are passing, but at the end of the "test" step we get the following and CircleCI shows a failed status:

================== 955 passed, 2 skipped in 216.09s (0:03:36) ==================
corrupted double-linked list
/bin/bash: line 2:   278 Aborted                 (core dumped) poetry run coverage run -m pytest $TESTFILES -vv --junitxml htmlcov/junit.xml

Exited with code exit status 134
CircleCI received exit code 134

There are no other errors, warnings, or unexpected output. I cannot replicate the issue outside of CircleCI.

I tried adding the @pytest.mark.asyncio decorator to the one async test we have and still got the above. Even when I totally remove said test CircleCI still throws the same. Google has not been helpful.

Edit:
This same thing has also happened a couple of times during the "migrate" step of our CircleCI workflow. That step just runs poetry run python manage.py migrate so this is not exclusive to pytest.

Asked By: TWGerard

||

Answers:

This turned out to be some kind of issue with our poetry.lock file. The solution was to check out the original pyproject.toml and poetry.lock files from master and then re-install the new dependencies on top of that.

Answered By: TWGerard