I've modified gluon/rewrite.py to log functions and controllers:

if self.args:
    try:
        mylog = open('mylog.txt', 'a')
        mylog.write('%s %s\n' % (self.functions, self.controllers))
        mylog.close()
    except:
        pass
    if self.args[0] in self.functions or self.args[0] in self.controllers or 
self.args[0] in applications:
        self.omit_function = False


In the generated log I don't see anything weird:

set([]) set(['load', 'default', 'app', 'static'])
set([]) set(['load', 'default', 'app', 'static'])
set([]) set(['load', 'default', 'app', 'static'])
set([]) set(['load', 'default', 'app', 'static'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])
set([]) set(['default', 'cache', 'afip', 'reportes', 'contrataciones', 
'admin', 'paypal', 'errores', 'periodos', 'facturas', 'ws', 'sitios', 
'scheduler', 'static', 'mercadopago', 'estadistica', 'notificaciones'])


There is a bunch of that. Notice the function list is always empty, I'm not 
sure if that's correct (I would say yes, because everything works as 
expected).
The list of controllers is correct, they correspond to the application 
running in each case.

Because I have many many applications installed and running, the log file 
was growing very quickly, so I made a simple modification to the code, to 
log only when the application was one of the ones throwing the error:

if self.args:
    try:
        if self.application in ('pescaregional', 'experienciasgo'):
            mylog = open('mylog.txt', 'a')
            mylog.write('%s %s\n' % (self.functions, self.controllers))
            mylog.close()
    except:
        pass
    if self.args[0] in self.functions or self.args[0] in self.controllers or 
self.args[0] in applications:
    self.omit_function = False


The log was the same as the one I showed before.
However, I've noticed that *self.application is not set in the scheduler 
environment*, because the logging was done when the requests were made 
through http, but nothing was logged when the requests came from the 
scheduler environment.


Anyway, I think this is too much for me. Debugging this is getting hard, as 
the problem happens only in my production environment, and I don't like 
very much the idea of changing web2py code of the main instance that is 
running several apps. Regardless I use uwsgi gracefully reloading, I've 
done this tests very late at night, when the activity is low, but still I'm 
afraid of breaking something at production.

For now, I'll just apply a simple patch: whenever I use URL() in the 
scheduler environment, I'll check that the args are provided as strings.
Thanks a lot for your help!!

El martes, 4 de septiembre de 2018, 11:43:28 (UTC-3), Leonel Câmara 
escribió:
>
> The problems seems to be in the controllers and not in the application 
> list since looking at your logs they seem to be fine.
>
> Notice that "load" does not check if the controllers are coming just with 
> "DEFAULT" string.
>
> https://github.com/web2py/web2py/blob/master/gluon/rewrite.py#L283
>
> Can you log the controllers too?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to