Hi,
I have a serious issue. Got a web2py install running as a service on a Windows 2003 box with SQL Server, with applications serving 100s of users in-house. We have a live and test application running on the same install but pointing to different databases, and due to things not being released these have diverged quote a bit over the months. We just managed to reconcile these (with carefully supervised migration - one table at a time) last week, and the problems started happening. Web2py becomes unresponsive after a period of use - it just hangs when you try to load a page. There are no errors in web2py, in the event manager, or SQL. Rolling back those changes is tricky, as there have been changes to the database and data has already been added..
When left running over the weekend, its fine. If I try accessing every page, it's fine (or at least, I can't break it). If it goes into proper use with lots of other people accessing it, it crashes.
I don't know how to find out what's going wrong. It's a relatively recent build of web2py, and I don't want to upgrade to throw yet another variable in there (there also been changes to the server it uses fro its mail function, though that seems to work fine, and we just removed IIS from the same server).
Any ideas why web2py would just freeze?
Hi Derek,
Thanks for replying, I had checked those but the last entry was months old, so that was a dead end.
I finally got web2py running on Apache, though it took me till 5 am :-)
(ps: if anyone else plans on attempting to install Apache on Windows against MSSQL, I'm happy to help out or write a tutorial, it wasn't straightforward! Feel free to pm me)
I left both the rocket and the apache web2py installs live running on separate servers (pointing to same database) and advised the users to work on both. When I checked after a few hours, the rocket one had become unresponsive, and apache was still running fine.
I think the problem is something to do with to the server being overloaded, and perhaps ajax calls time out and holding locks on the sessions files, causing the whole thing to become unresponsive. There were multiple threads interacting with the same session files judging from the debugger... If anyone would like me to do more investigation on this, I'm happy to help so long as you tell me where to look.
Apache also caused a rather funny issue... A set of ajax calls which were meant to run synchronously (because of "async: false" flag) was failing to complete before page reload, whereas it always did before, leading me to think Apache was not running it synchronously as instructed. What I think is happening is that the ajax call never ran synchronously in the first place (it's in a jQuery.each() loop) but on rocket it always finished on time before the page reload, and apache seems to reload way faster so caught me out.
Word to the wise: check any assumptions you make about ajax running synchronously or not, especially as async: false is deprecated in jQuery 1.8.
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/PEC1uLfzlrU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
async option to $.ajax() defaults to true, indicating that code execution can continue after the request is made. Setting this option to false (and thus making the call no longer asynchronous) is strongly discouraged, as it can cause the browser to become unresponsive.Ah, if you are on Windows, I would recommend you run it with gevent instead of rocket, it should be faster than even apache.
hard ? with DAL it's pretty easy.... if a module exposes the dbapi just force the driver and implement the connect method and it's usually good to go.
I'll test it when I get back home.
--
I had a puzzling problem with 2.7.4 as a rocket service on Windows 2003, but this was a problem with sqlform.grids. There was a print statement left in code which caused the service to stop working. This cause doesn't match with your insights into the problem, but I mention it anyway. You only see the problem when web2py is running as a service (I use nssm to create the service, but this is not relevant).
The problem was very quickly fixed in trunk, but as far as I know the fix is not in any stable version yet.
I'm still using 2.6.4 for production apps in this scenario (rocket as a service on windows server).
--
--
Further update:
Apache did finally crash, with the following message:
"Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting"
I've bumped that up to 500, and there are less than that number of users on the system (although I understand there will be more than one connection fired off per user/session).
But it crashed/became unresponsive again with no error message!
I added mod_status to see what's going on, and it seems there are loads of requests being sent to which never exit, and I can't tell where these are being fired from as they don't indicate which virtualhost they came from (and no url mapping). I'm waiting for approval to join apachelounge to ask over there, but thought I'd ask here if anyone had any information on how web2py uses/creates requests/threads in apache, and how it could be that apache becomes unresponsive after a while. I'm not even sure it is running out of workerthreads (I thought servers queued requests till threads became available specifically so they wouldn't crash under heavy load).
Also, I leave sessions alone, but should I be clearing them?
Also also, I updated to the latest version of web2py and it seems someone left a print statement in SQLFORM.grid() which prints every row! (Line 2373 in sqlhtml.py) I presume that if I were running that as a windows service on rocket it would crash the moment you displayed a grid...
Further update:
Apache did finally crash, with the following message:
"Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting"
I've bumped that up to 500, and there are less than that number of users on the system (although I understand there will be more than one connection fired off per user/session).
But it crashed/became unresponsive again with no error message!
Also, I leave sessions alone, but should I be clearing them?
Also also, I updated to the latest version of web2py and it seems someone left a print statement in SQLFORM.grid() which prints every row! (Line 2373 in sqlhtml.py) I presume that if I were running that as a windows service on rocket it would crash the moment you displayed a grid..
--