Sorry for noise.
I installed clean ubuntu 12.04 with python 2.7.3 onboard and
everything works perfectly.
So this was an incorrect xubuntu upgrade issue.

2012/7/30 Evgeny Turnaev <[email protected]>:
> Acquiring gil didn't helped.
> I switched to python 2.7.2.
> Will try to investigate on segfault later.
> Maybe the cause was because of incorrect upgrade of xubuntu 11 to 12.04.
>
> 2012/7/27 Evgeny Turnaev <[email protected]>:
>> Hmm.. i googled and it is seems PyImport_ImportModule should be called
>> with gil acquired. (no sure)
>> I'll check on Monday if it fixes problem.
>> Does get_uwsgi_pydict (from uwsgi_uwsgi_loader) get called with gil acquired?
>>
>> 2012/7/27 Evgeny Turnaev <[email protected]>:
>>> *but/bug typo
>>>
>>> 2012/7/27 Evgeny Turnaev <[email protected]>:
>>>> Roberto,
>>>>   As i have poor experience using python api could you please confirm
>>>> that this is a python but that this code segfaults
>>>>
>>>> ==== main.c ====
>>>>
>>>> #include <Python.h>
>>>> #include <stdio.h>
>>>>
>>>> int main(){
>>>>
>>>>     printf("hello\n");
>>>>     Py_Initialize();
>>>>     PyThreadState *main_thread = PyThreadState_Get();
>>>>     printf("Main thread: %p\n", main_thread);
>>>>
>>>>     PyObject * wsgi_module = PyImport_ImportModule("logging.config");
>>>>     if(! wsgi_module){
>>>>         printf("!wsgi_module\n");
>>>>         return 0;
>>>>     }
>>>>     PyObject * wsgi_dict = PyModule_GetDict(wsgi_module);
>>>>     if(!wsgi_dict){
>>>>         printf("wsgi_dict\n");
>>>>         return 0;
>>>>     }
>>>>     printf("wsgi_dict!\n");
>>>>     PyObject * application = PyDict_GetItemString(wsgi_dict, 
>>>> "application");
>>>>     printf("application: %p\n", (void *)application);
>>>>
>>>>     return 0;
>>>> }
>>>>
>>>> ============ end main.c ============
>>>>
>>>> gcc ./main.c -o import_test -L/usr/lib/python2.7/config -lpython2.7
>>>> -I/usr/include/python2.7/
>>>>
>>>> Output
>>>> turnaev@nostromo:~/box/trunk/frontend_new/src$ ./import_test
>>>> hello
>>>> Main thread: 0x1d3c0a0
>>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>>> Segmentation fault (core dumped)
>>>>
>>>>
>>>> 2012/7/27 Evgeny Turnaev <[email protected]>:
>>>>> Update. This is not gc stuff. I disabled gc and
>>>>> segfault is still reproducible in import _socket line of socket.py
>>>>>
>>>>> 2012/7/27 Evgeny Turnaev <[email protected]>:
>>>>>> No traceback :(
>>>>>> Pretty strage as i remember uwsgi sets signal handler for sigsegv.
>>>>>> Is there a way to manually provide traceback?
>>>>>>
>>>>>> Further investigation shows segfault happens in
>>>>>>
>>>>>> import _socket line in socket.py of python stdlib
>>>>>> (socket.py imported in logging)
>>>>>> Also i enabled gc.debug and it is seems gc is sollecting something before
>>>>>> segfault so think there is a pointer somethere to collected object and
>>>>>> someone is accessing it.
>>>>>>
>>>>>> Fri Jul 27 17:29:12 2012 - *** Operational MODE: preforking ***
>>>>>> gc: collecting generation 0...
>>>>>> gc: objects in each generation: 845 3122 0
>>>>>> gc: done, 0.0004s elapsed.
>>>>>> gc: collecting generation 0...
>>>>>> gc: objects in each generation: 789 3527 0
>>>>>> gc: done, 0.0003s elapsed.
>>>>>> gc: collecting generation 0...
>>>>>> gc: objects in each generation: 891 3809 0
>>>>>> gc: done, 0.0006s elapsed.
>>>>>> before import _socket
>>>>>> Fri Jul 27 17:29:12 2012 - !!! uWSGI process 12119 got Segmentation 
>>>>>> Fault !!!
>>>>>>
>>>>>> The strange thing also is that import logging.config works ok in
>>>>>> python interactive shell and when run as script.
>>>>>>
>>>>>> 2012/7/27 Roberto De Ioris <[email protected]>:
>>>>>>>
>>>>>>> Il giorno 27/lug/2012, alle ore 14:57, Evgeny Turnaev ha scritto:
>>>>>>>
>>>>>>>> Hello.
>>>>>>>>  I experience segmentation fault with a very simple setup.
>>>>>>>>
>>>>>>>> I do:
>>>>>>>> sudo uwsgi -s /var/run/uwsgi_hypernova.sock -M -p 3 -w app
>>>>>>>>
>>>>>>>> *** Starting uWSGI 1.3-dev-2470 (64bit) on [Fri Jul 27 16:51:36 2012] 
>>>>>>>> ***
>>>>>>>> compiled with version: 4.6.3 on 27 July 2012 16:39:02
>>>>>>>> os: Linux-3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012
>>>>>>>> nodename: nostromo
>>>>>>>> machine: x86_64
>>>>>>>> detected number of CPU cores: 2
>>>>>>>> current working directory: /home/turnaev/box/trunk/frontend_new/src
>>>>>>>> detected binary path: /usr/local/bin/uwsgi
>>>>>>>> uWSGI running as root, you can use --uid/--gid/--chroot options
>>>>>>>> *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
>>>>>>>> your memory page size is 4096 bytes
>>>>>>>> detected max file descriptor number: 1024
>>>>>>>> lock engine: pthread robust mutexes
>>>>>>>> uwsgi socket 0 bound to UNIX address /var/run/uwsgi_hypernova.sock fd 3
>>>>>>>> Python version: 2.7.3 (default, Apr 20 2012, 23:04:22)  [GCC 4.6.3]
>>>>>>>> *** Python threads support is disabled. You can enable it with
>>>>>>>> --enable-threads ***
>>>>>>>> Python main interpreter initialized at 0x1e9f900
>>>>>>>> your server socket listen backlog is limited to 100 connections
>>>>>>>> *** Operational MODE: preforking ***
>>>>>>>> !!! uWSGI process 11162 got Segmentation Fault !!!
>>>>>>>
>>>>>>> no c traceback after that line ?
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Roberto De Ioris
>>>>>>> http://unbit.it
>>>>>>> JID: [email protected]
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> uWSGI mailing list
>>>>>>> [email protected]
>>>>>>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> --------------------------------------------
>>>>>> Турнаев Евгений Викторович
>>>>>> +7 906 875 09 43
>>>>>> --------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> --------------------------------------------
>>>>> Турнаев Евгений Викторович
>>>>> +7 906 875 09 43
>>>>> --------------------------------------------
>>>>
>>>>
>>>>
>>>> --
>>>> --------------------------------------------
>>>> Турнаев Евгений Викторович
>>>> +7 906 875 09 43
>>>> --------------------------------------------
>>>
>>>
>>>
>>> --
>>> --------------------------------------------
>>> Турнаев Евгений Викторович
>>> +7 906 875 09 43
>>> --------------------------------------------
>>
>>
>>
>> --
>> --------------------------------------------
>> Турнаев Евгений Викторович
>> +7 906 875 09 43
>> --------------------------------------------
>
>
>
> --
> --------------------------------------------
> Турнаев Евгений Викторович
> +7 906 875 09 43
> --------------------------------------------



-- 
--------------------------------------------
Турнаев Евгений Викторович
+7 906 875 09 43
--------------------------------------------
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to