Worker was terminated due to signal 4

Hello there.

I have a project that used to work just fine, but after upgrading Django and other dependancies, it won’t run on my server anymore. Here are the details :

First of all, the dependancies :

[tool.poetry.dependencies]
python = "^3.10"
django = "^4.1.7"
django-environ = "^0.10.0"
django-crispy-forms = "^2.0"
gunicorn = "^20.1.0"
mypy = "^1.1.1"
django-stubs = "^1.16.0"
djangorestframework = "^3.14.0"
djangorestframework-simplejwt = "^5.2.2"
django-cors-headers = "^3.14.0"
django-ninja = "^0.21.0"
orjson = "^3.8.9"
tqdm = "^4.65.0"
django-cleanup = "^7.0.0"
django-anymail = {version = "^10.0", extras = ["mailjet"]}
wcwidth = "^0.2.6"
psycopg2-binary = "^2.9.6"
psycopg = "^3.1.9"

Next, what works locally :

  • running pytest
  • running ./manage.py runserver
  • running gunicorn --bind :8000 --workers 3 main.wsgi

Next, the way it fails on the server :

[2023-05-14 18:56:47 +0000] [1] [WARNING] Worker with pid 20 was terminated due to signal 4

… on each request ;

And finally, since signal 4 is a SIGILL, lscpu on the local machine and server :

My local box

➜  ~ lscpu
Architecture :                              x86_64
  Mode(s) opératoire(s) des processeurs :   32-bit, 64-bit
  Address sizes:                            43 bits physical, 48 bits virtual
  Boutisme :                                Little Endian
Processeur(s) :                             16
  Liste de processeur(s) en ligne :         0-15
Identifiant constructeur :                  AuthenticAMD
  Nom de modèle :                           AMD Ryzen 7 3800XT 8-Core Processor
    Famille de processeur :                 23
    Modèle :                                113
    Thread(s) par cœur :                    2
    Cœur(s) par socket :                    8
    Socket(s) :                             1
    Révision :                              0
    Frequency boost:                        enabled
    CPU(s) scaling MHz:                     47%
    Vitesse maximale du processeur en MHz : 4722,6558
    Vitesse minimale du processeur en MHz : 2200,0000
    BogoMIPS :                              7800,93
    Drapaux :                               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx 
                                            fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good 
                                            nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma c
                                            x16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm exta
                                            pic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext p
                                            erfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba
                                             ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushop
                                            t clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm
                                            _mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save 
                                            tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave
                                            _vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es
Virtualization features:                    
  Virtualisation :                          AMD-V
Caches (sum of all):                        
  L1d:                                      256 KiB (8 instances)
  L1i:                                      256 KiB (8 instances)
  L2:                                       4 MiB (8 instances)
  L3:                                       32 MiB (2 instances)
NUMA:                                       
  Nœud(s) NUMA :                            1
  Nœud NUMA 0 de processeur(s) :            0-15
Vulnerabilities:                            
  Itlb multihit:                            Not affected
  L1tf:                                     Not affected
  Mds:                                      Not affected
  Meltdown:                                 Not affected
  Mmio stale data:                          Not affected
  Retbleed:                                 Mitigation; untrained return thunk; SMT enabled with STIBP protection
  Spec store bypass:                        Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:                               Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:                               Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS 
                                            Not affected
  Srbds:                                    Not affected
  Tsx async abort:                          Not affected

The crashy server (kind of old) :

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   36 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           54
Model name:                      Intel(R) Atom(TM) CPU N2800   @ 1.86GHz
Stepping:                        1
CPU MHz:                         799.910
CPU max MHz:                     1862.0000
CPU min MHz:                     798.0000
BogoMIPS:                        3732.91
L1d cache:                       48 KiB
L1i cache:                       64 KiB
L2 cache:                        1 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1:        Not affected
Vulnerability Spectre v2:        Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm p
                                 be syscall nx lm constant_tsc arch_perfmon pebs bts nopl nonstop_tsc cpuid aperfmperf pni dtes64 monitor ds_cpl est t
                                 m2 ssse3 cx16 xtpr pdcm movbe lahf_lm dtherm arat

Sorry for all the code but I wanted to give as much details as possible !
If anyone has an idea, maybe just how I can get better logs…

Thanks a lot.
Cheers

By the way, the app is packaged using docker and run using docker-compose. I’ve checked that the image is not built for ARM