The issue is probably related to opening a subprocess in uWSGI, not the 
external folder into which you are copying files. Have a look at 
https://stackoverflow.com/a/17607704. Maybe setting "--close-on-exec" in 
your uWSGI configuration will work. Alternatively, consider using the 
web2py scheduler to handle running the task.

Anthony

On Wednesday, September 20, 2017 at 7:54:24 AM UTC-4, Lisandro wrote:
>
> Hi, I'm having a hard time to figure out why web2py throws this error in 
> this scenario.
>
> I have one web2py installation, with the same app installed **a lot** of 
> times. The app is a simple app I've designed to create and mantain your own 
> website. So the app is one, but it's installed several times, each time 
> it's installed with a different name, and a specific configuration file 
> that tells the app wich database to connect, wich domain to serve, etc. 
>
> Up to here, everything works ok. I take the opportunity to say that web2py 
> really rocks, it's completely scalable! I'm using nginx + uwsgi + web2py. 
> My whole enviroment receives thousands of requests per day (of course, I 
> had to consider some tunnings as compile the apps, using lazy_tables, 
> disabling migrations, etc). But I wanted to say that, because in the past 
> I've seen some posts saying that web2py wasn't scalable. Nothing more far 
> from the truth. Not only I use web2py in a high load environment, but also 
> I developed another web2py app to help me with the administrative tasks of 
> managing all the other apps. I could successfully develop a web2py app that 
> allows me to install other apps, change nginx configuration, restart uwsgi, 
> creating/deleting databases, even upgrading the other apps. I say it again: 
> web2py really rocks!!
>
> Back to the issue. Everytime I install a copy of my app in that one web2py 
> installation, I do it cloning a Mercurial repository I have on 
> bitbucket.org (by the way, I do all that from my cutom administrative 
> web2py app).
> The problem was that this approach would depend on the availability of 
> bitbucket.org: if the service is down or degraded, I couldn't perform an 
> update of the apps. So, I thought I would need to have a local copy on the 
> repository, and do de pull & update from that local repository, so I 
> wouldn't depend on bitbucket.org. Every time to time, I would need to do 
> a pull from the bitbucket repository in order to have the local one up to 
> date.
>
> My web2py folder structure looks something like this:
>
> web2py/applications/administrative
> web2py/applications/app1
> web2py/applications/app2
> web2py/applications/app3
> web2py/applications/app4
> web2py/local_repository
>
>
> Notice the administrative application, the installed apps, and the 
> "local_repository" folder having the cloned repository from bitbucket. From 
> the administrative app, when I need to add a website, I run a custom code 
> that clones the local repository as a new app, creates the database, etc, 
> restarts uwsgi, and reloads nginx configuration. Up to here, it's all good 
> too.
>
> Now, the problem appeared when I added a simple function inside the 
> administrative app, in order to do a pull from bitbucket to the 
> local_repository. The funcion is very simple, and it uses subprocess to run 
> an hg pull, as simple as that. And it works ok. The problem is that, after 
> doing that pull, *all the other apps start throwing errors, and I need to 
> restart uwsgi in order to avoid those errors*. My first thought was that 
> restarting uwsgi was needed in the same way is needed when I update an 
> installed app (that is obvious, if I update an app and compile it, I have 
> to restart uwsgi in order to make the new code visible). 
> But, considering that doing a pull is trivial and does not affect the 
> installed running apps, I wanted to avoid restarting uwsgi in that case. So 
> my first idea was to move the "local_repository" folder out of the web2py 
> folder, so my structure looks like this:
>
> folder/web2py/applications/administrative
> folder/web2py/applications/app1
> folder/web2py/applications/app2
> folder/web2py/applications/app3
> folder/web2py/applications/app4
> folder/local_repository
>
> Notice that now the "local_repository" is completely outside the web2py 
> folder.
> However, and *this is the weird part: after doing a pull inside that 
> local_repository folder, I still need to restart uwsgi, because if I don't, 
> all the installed apps start throwing error!*
> I'm confused about that. *I don't see how the apps need uwsgi to be 
> restarted after doing a pull in a folder that is completely outside 
> web2py's folder*.
>
> Any thoughts on this?
> Thank you very much in advance!
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to