>>>>
>>>
>>> Signals are registered ASAP so if your module define function at
>>> address
>>> 0xAAAAAAAA uWSGI will put this address in the signal table.
>>>
>>> But at a point in your module code, an exception is raised and all of
>>> the
>>> module memory is freed and 0xAAAAAAAA is no more valid.
>>
>> Where exactly does it become an issue when an exception is raised?
>> Raising exceptions is an essential part of my @spool functions so that
>> they keep retrying (SPOOL_RETRY) until the function returns
>> successfully and thus SPOOL_OK is sent to uwsgi
>
> Ah, I just re-read the thread and noticed that you said that the rogue
> exception may be escaping from the spool thread somewhere.  If this is
> the case, why do you think the spooler exception is getting through
> (and then possibly crashing the subsystem) only when timers are being
> registered?  As far as I can tell, the timer is not raising any sort
> of exception when they're actually being executed.
>

You can raise all of the exceptions you want safely. You have only to
worry about exceptions raised during module import (with --import) as all
of the signal handlers registered before the exception will became invalid
and will crash workers as soon as they are called. Ex.

# mymodule.py
register_signal(1,...)
register_signal(2,...)
register_signal(3,...)
register_signal(4,...)
register_signal(5,...)
raise Exception("foo")
register_signal(6,...)

If you do a --import mymodule

you will register the first 5 signals, but as soon as the exception is
raised, their function pointers got removed from memory. Then, if you
raise signal from 1 to 5, your worker will crash.

You need only to check for exception in the importing phase, then you are
safe. Removing your 65-67 timer registering (raising the exception) you
allowed uWSGI ti successfully import the module

In a standard python environment this is not a problem, as having an
uncatched exception will always destroy the interpreter exiting the
process.

uWSGI --import instead, can continue its execution (as you can try to
import multiple module in sequence) opening to this specific problem.

Simply solve the timer numbers issue and you are ready. (by the way i will
raise the number of allowed timers to 256 in 1.0)

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to