Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving the cannot allocate memory in static TLS block ERROR #230

Open
dr-robert-li opened this issue Sep 25, 2024 · 2 comments
Open

Solving the cannot allocate memory in static TLS block ERROR #230

dr-robert-li opened this issue Sep 25, 2024 · 2 comments

Comments

@dr-robert-li
Copy link

I note that I'm not the only one that has suffered this error in the past:

ERROR 2024-09-25 20:29:16,864 signal 8 281473223794704 Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0xffff94bea1d0>> raised: ImportError('/usr/local/lib/python3.10/site-packages/torch/lib/../../torch.libs/libgomp-804f19d4.so.1.0.0: cannot allocate memory in static TLS block')

In the previously raised issue this was resolved adding this workaround to the local.yml:

services:
  django: &django
    environment:
      - LD_PRELOAD=/usr/local/lib/python3.10/site-packages/torch/lib/../../torch.libs/libgomp-804f19d4.so.1.0.0

This didn't work for me.

When researching this error in other packages (starting with the pytorch repo) and other repos, it appears to be common when dealing with Apple Silicon (M{x}) chipsets.

So after a lot of messing around, I found I could successfully launch a local build with no issues if I explicitly set: platform: linux/amd64 in the local.yml docker compose manifest to force emulation of the architecture probably present on your local machine.

I propose that this small change be added to the main branch:

services:
  django: &django
    build:
      context: .
      args:
        - GITHUB_ACTIONS
      dockerfile: ./compose/local/django/Dockerfile
    image: opencontractserver_local_django
    platform: linux/amd64
    depends_on:
      - postgres
      - redis
      - vector-embedder
      - nlm-ingestor
    volumes:
      - .:/app:z
    env_file:
      - ./.envs/.local/.django
      - ./.envs/.local/.postgres
    ports:
      - "8000:8000"
    command: /start

Also another small ask, can we also add to documentation, especially in quickstart, the need to fill out the DJANGO_SECRET_KEY= and the POSTGRES_USER= / POSTGRES_PASSWORD= in the sample_env files. I know, I was lazy and I just pushed everything through without checking, so definitely user error, but would be good to explicitly point this out.|

Otherwise, thanks! This is a great open source package!

@dr-robert-li
Copy link
Author

For reference here is the previously closed issue: #135

@JSv4
Copy link
Owner

JSv4 commented Oct 7, 2024

Thanks for the input @dr-robert-li. Both great suggestions. Will try to roll this into some upcoming PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants