Reputation: 151
I'm running a dev uwsgi server using flask and a call to requests.get is triggering a segmentation fault in the uWSGI process.
Segmentation Fault:
!!! uWSGI process 70490 got Segmentation Fault !!!
*** backtrace of 70490 ***
0 uwsgi 0x000000010b394c70 uwsgi_backtrace + 48
1 uwsgi 0x000000010b3951b3 uwsgi_segfault + 51
2 libsystem_platform.dylib 0x00007fff82784eaa _sigtramp + 26
3 ??? 0x0000000000000000 0x0 + 0
4 libxpc.dylib 0x00007fff914d2aa0 xpc_connection_resume + 192
5 CoreFoundation 0x00007fff91fbb9d1 _CFPrefsWithDaemonConnection + 353
6 CoreFoundation 0x00007fff91f8aae6 __66-[CFPrefsSearchListSource generationCountFromListOfSources:count:]_block_invoke + 150
7 CoreFoundation 0x00007fff91f8a883 -[CFPrefsSearchListSource generationCountFromListOfSources:count:] + 179
8 CoreFoundation 0x00007fff91e39cb4 -[CFPrefsSearchListSource alreadylocked_copyDictionary] + 324
9 CoreFoundation 0x00007fff91e3498c -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 60
10 CoreFoundation 0x00007fff91fbc64c ___CFPreferencesCopyAppValueWithContainer_block_invoke + 60
11 CoreFoundation 0x00007fff91f89750 +[CFPrefsSearchListSource withSearchListForIdentifier:container:perform:] + 608
12 CoreFoundation 0x00007fff91fbc5c7 _CFPreferencesCopyAppValueWithContainer + 183
13 SystemConfiguration 0x00007fff92301aab SCDynamicStoreCopyProxiesWithOptions + 163
14 _scproxy.so 0x000000010bdac914 init_scproxy + 58
15 Python 0x000000010b55aa90 PyEval_EvalFrameEx + 13533
16 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
17 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
18 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
19 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
20 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
21 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
22 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
23 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
24 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
25 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
26 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
27 Python 0x000000010b4fc2e5 PyFunction_SetClosure + 828
28 Python 0x000000010b4de202 PyObject_Call + 99
29 Python 0x000000010b55a4ac PyEval_EvalFrameEx + 12025
30 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
31 Python 0x000000010b4fc2e5 PyFunction_SetClosure + 828
32 Python 0x000000010b4de202 PyObject_Call + 99
33 Python 0x000000010b55a4ac PyEval_EvalFrameEx + 12025
34 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
35 Python 0x000000010b55d4ae _PyEval_SliceIndex + 342
36 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
37 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
38 Python 0x000000010b55d4ae _PyEval_SliceIndex + 342
39 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
40 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
41 Python 0x000000010b4fc2e5 PyFunction_SetClosure + 828
42 Python 0x000000010b4de202 PyObject_Call + 99
43 Python 0x000000010b55a4ac PyEval_EvalFrameEx + 12025
44 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
45 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
46 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
47 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
48 Python 0x000000010b55d541 _PyEval_SliceIndex + 489
49 Python 0x000000010b55a30c PyEval_EvalFrameEx + 11609
50 Python 0x000000010b5573c1 PyEval_EvalCodeEx + 1583
51 Python 0x000000010b4fc2e5 PyFunction_SetClosure + 828
52 Python 0x000000010b4de202 PyObject_Call + 99
53 Python 0x000000010b4e8ff5 PyMethod_New + 1221
54 Python 0x000000010b4de202 PyObject_Call + 99
55 Python 0x000000010b524a33 _PyObject_SlotCompare + 2939
56 Python 0x000000010b4de202 PyObject_Call + 99
57 Python 0x000000010b55ce83 PyEval_CallObjectWithKeywords + 165
58 uwsgi 0x000000010b3b0287 python_call + 23
59 uwsgi 0x000000010b3b24b0 uwsgi_request_wsgi + 880
60 uwsgi 0x000000010b346770 wsgi_req_recv + 288
61 uwsgi 0x000000010b39292a simple_loop_run + 218
62 uwsgi 0x000000010b399f7b uwsgi_ignition + 443
63 uwsgi 0x000000010b399d73 uwsgi_worker_run + 883
uWSGI command:
uwsgi --http 0.0.0.0:8083 --ini uwsgi.ini
uWSGI ini
[uwsgi]
# this config will be loaded if nothing specific is specified
# load base config from below
ini = :base
# %d is the dir this configuration file is in
socket = %d/conf/app.sock
master = true
processes = 4
[dev]
ini = :base
# socket (uwsgi) is not the same as http, nor http-socket
socket = :8001
[local]
ini = :base
http = :8000
# set the virtual env to use
home=$dappenv
[base]
# chdir to the folder of this config file, plus app/website
chdir = %d
# load the module from wsgi.py, it is a python path from
# the directory above.
module = app.application:app
# allow anyone int the group to connect to the socket.
chmod-socket=666
Offending code snippet:
def find_places_with_name(self, name):
url = "{}/textsearch/json?query={}&key={}".format(
self.api_url_root,
name,
self.api_key
)
#search_response = requests.get(url)
# THE NEXT LINE IS THE LINE THAT BREAKS
search_response = requests.get('http://www.google.com')
if search_response.status_code != 200:
# TODO throw/log
pass
return search_response.json()
Versions:
Running the python code snippet directly from the command line works with no issues.
I reinstalled uwsgi and that didn't seem to work. I'm not super familiar with the intricacies of uWSGI configuration parameters. Is it possible that there is something in my configuration file that is causing this?
Upvotes: 15
Views: 3362
Reputation: 2860
From later users with python3, appears that forking non-fork-safe libraries in MacOS might be the issue. See this, including workaround: https://bugs.python.org/issue30385
Upvotes: 0