Il giorno ven 29 mag 2020 alle ore 23:32 Glenn Reed <gl...@webquest.co.nz>
ha scritto:

> Dear UWSGI team,
>
> I had a bizarre problem with my Django/Wagtail app running under UWSGI
> emperor. The individual sites running as vassals.  One in particular
> which is probably the single biggest wagtail site we've built to date
> has recently run into problems.  It revolved around reading a .env file
> with our third party API keys stored in it.  There were two files that
> we used.  One for the test keys and one for the live keys.  However I
> deleted all the files containing test keys and/or moved them completely
> out of that directory/folder and yet even after restarting the vassal
> (using the touch command on the ini file) it still seemed to use the
> same file contents as though the file was not being closed and
> reopened.  This meant that even though we thought the website was
> running in live mode with the live API keys to a webservice it was in
> fact still running with the test API keys. In fact it didn't read the
> correct contents until I restarted the emperor process itself.  Does
> anyone know what options to add into the vassal .ini file to ensure
> that all file handles are recycled on a vassal reload as it doesn't
> appear to be the default option.
>
>
> Hi Glenn, there could be various reasons, but generally you do not need to
restart the whole emperor stack. Rename/remove the vassal file, wait for
shutdown of the vassal, and then rename/recopy it.

Now, from what you describe it really looks like the file descriptor of the
file is not closed, this could be a problem in your code, in the code of
the library, or the usage of fork().

I would start with doing a simple test by adding

lazy-apps = true

to the vassal file and retrying (this will avoid running code in the master
process)

During tests (you can do them out of the emperor), check the content of
/proc/pid_of_masters/fds it should give you useful infos.

Roberto
_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to