Web2py freezes when inserting rows. Problem seems to be database connection limit per application.

48 views
Skip to first unread message

William

unread,
Feb 27, 2019, 2:35:46 PM2/27/19
to web2py-users
Hi all, my application has a tendency to freeze whenever I run a process that inserts row to the database. Does anyone know how to fix this?

I'm currently deploying Web2py on DigitalOcean using nginx + uwsgi and MySQL database. My uwsgi has the following settings:

chdir = WEB2PY_PATH_PLACEHOLDER/WEB2PY_APP_PLACEHOLDER
module = wsgihandler:application 
master = true
processes = 5

uid = USERNAME_PLACEHOLDER
socket = /run/uwsgi/WEB2PY_APP_PLACEHOLDER.sock
chown-socket = USERNAME_PLACEHOLDER:nginx
chmod-socket = 660
vacuum = true

I have also tried setting DAL pool_size = 10 but to no avail. 

However I have found a temporary fix by creating a new application to access the same database. If I insert rows using the second application, the first application no longer freezes up. 

Hence I believe there's some kind of connection limit per application that is causing my app to hang whenever I insert rows. How can I fix it?

Leonel Câmara

unread,
Feb 27, 2019, 4:41:51 PM2/27/19
to web2py-users
If you're inserting a lot of rows you should probably be using the scheduler. That said you don't have a harakiri config so it's probably a timeout in your nginx config.

William

unread,
Mar 1, 2019, 4:24:19 AM3/1/19
to web...@googlegroups.com
Ok I have somehow fixed this by adding "enable-threads = true" to my uwsgi ini file. Just leaving this here in case someone faces the same problem. 

[uwsgi]
chdir = /opt/web2py_apps/web2py

module = wsgihandler:application
master = true
enable-threads = true
processes = 10
uid = web2py
socket = /run/uwsgi/web2py.sock
chown-socket = web2py:nginx
Reply all
Reply to author
Forward
0 new messages