#32293: import _scproxy and spatialite database backend segfaults
-----------------------------------------+------------------------
               Reporter:  Jon Janzen     |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  3.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 This bug started happening to me when I upgraded to macOS 11 Big Sur, but
 this may be coincidence as I upgraded all of my homebrew packages at the
 same time.

 This bug was traced down from having the `graphene_django` module in
 `INSTALLED_APPS`. This module imports a lot of things but one of which is
 `urllib.request`, which in turn actually imports `_scproxy`.

 === Steps to reproduce:
 1. `django-admin startproject crashdemo && cd crashdemo`
 2. Edit `crashdemo/settings.py` to use the `spatialite` backend instead of
 `sqlite3`
 3. Add `import _scproxy` to `settings.py` (actual file doesn't matter, as
 long as it's imported during django startup)
 4. Run `python3 manage.py runserver --noreload` (`--noreload` not strictly
 necessary, but it causes the segfault to occur in the main thread)

 === Expected outcome:
 Django starts up normally.

 === Actual outcome:
 {{{
 Performing system checks...

 System check identified no issues (0 silenced).
 Segmentation fault: 11
 }}}

 === My Environment:
 macOS Big Sur 11.1 (x86-64)
 sqlite3 is from homebrew
 libspatialite/gdal are from homebrew
 [email protected] from homebrew (issue still exists when building from latest
 source)
 django is 3.1.4 from pip (issue still exists when installing from latest
 source)

 I've set some debugging points inside the C source for the `_scproxy`
 module, and it seems like the functions provided by the module aren't even
 called leading up to the segfault. It seems like the shared object just
 needs to be loaded? I'm not sure how to debug this issue further.

 I've attached a macOS crash report and a Python traceback produced by
 cpython-lldb's py-bt command that indicates that this segfault is
 triggered when attempting to load the libspatialite extension into sqlite.
 I've confirmed this by wrapping that call with `print` statements and
 running without a debugger attached. The macOS crash report seems to point
 to something within `libsqlite` as being the culprit, but I don't really
 understand what I'm talking about here.

 Since I imagine this is a highly environment-specific bug report (perhaps
 just affecting my Mac), I'm happy to provide any additional information,
 run any tests, or try potential solutions to help solve this issue.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32293>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.ff01437e16824eb065ebeadb23c9f37e%40djangoproject.com.

Reply via email to