Re: [web2py] Re: Web2py freezing
The pool number is set to 10 . I tried also with 10 worker threads For what can i see there is something wrong in my app. The example app and a wizard app are correctly processed. Also the static pages like .html are fast rendered instead the pages rendered by the controller are very slow default/index *DYNAMIC PAGE DEFAULT/INDEX* Server Software:Apache/2.4.23 Server Hostname:10.51.130.53 Server Port:80 Document Path: / Document Length:6381 bytes Concurrency Level: 10 Time taken for tests: 3.454 seconds Complete requests: 10 Failed requests:1 (Connect: 0, Receive: 0, Length: 1, Exceptions: 0) Total transferred: 68429 bytes HTML transferred: 63809 bytes *Requests per second:2.90 [#/sec] (mean)* *STATIC PAGE INDEX.HTML (HELLO WORLD)* Server Software:Apache/2.4.23 Server Hostname:10.51.130.53 Server Port:80 Document Path: /Prototipo_RCG/static/downloads/index.html Document Length:13 bytes Concurrency Level: 10 Time taken for tests: 0.016 seconds Complete requests: 10 Failed requests:0 Non-2xx responses: 10 Total transferred: 2640 bytes HTML transferred: 130 bytes *Requests per second:639.59 [#/sec] (mean)* *Time per request: 15.635 [ms] (mean)* *Time per request: 1.563 [ms] (mean, across all concurrent requests)* *Transfer rate: 164.89 [Kbytes/sec] received* It seem application is slow interpreting .pyc files Il giorno martedì 25 ottobre 2016 10:56:21 UTC+2, mcm ha scritto: > > [Fri Oct 21 18:02:29.083973 2016] [mpm_winnt:notice] [pid 620:tid 320] > AH00354: Child: Starting 250 worker threads. > > This is a ridiculous high number of threads! ;-) > > If 10 is the magic number try looking at the pool number in your > appconfig.ini. > > If you need high concurrency try avoiding threads and use processes, > unless you are prepared to avoid mutexes anywhere in your code. > So you may look into using uwsgi, gunicorn or other webservers that can > fork instead of threading. > Uwsgi can be used alone or coupled with nginx. The latter if you need to > serve lots of static contents. > Keep in mind that *real* concurrency is bound to the number of available > cores of your CPUs if you use too many threads and/or too many processes > you are going to have troubles if there is any resource > contention, synchronization, happening > > If all of the above does not work, try using a Linux distribution... and > if that problem persists, you need to show us the code! > > ciao, > mic > > 2016-10-25 8:56 GMT+02:00 piero crisci > > : > >> Hi massimo and thanks fot the hint >> I tried with rocket from cmd line and this is result from Apache ab >> command line. >> I got the same result i have with APACHE WSGI as you can see below >> >> >> *MY APP WITH ROCKET * >> This is the command launch >> C:\web2py>python web2py.py >> *No handlers could be found for logger "web2py"* >> web2py Web Framework >> Created by Massimo Di Pierro, Copyright 2007-2016 >> *Version 2.14.3-stable+timestamp.2016.03.26.23.02.0*2 >> Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000 >> please visit: >> http://10.51.130.53/ >> starting browser... >> please visit: >> http://10.51.130.53:8080/ >> starting browser... >> >> >> C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 >> 10.51.130.53:8080/Prototipo_RCG/defaul >> t/index >> This is ApacheBench, Version 2.3 <$Revision: 1748469 $> >> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ >> Licensed to The Apache Software Foundation, http://www.apache.org/ >> >> Benchmarking 10.51.130.53 (be patient) >> Completed 100 requests >> Completed 200 requests >> Finished 270 requests >> >> >> Server Software:Rocket >> Server Hostname:10.51.130.53 >> Server Port:8080 >> >> Document Path: /Prototipo_RCG/default/index >> Document Length:6437 bytes >> >> Concurrency Level: 90 >> Time taken for tests: 115.700 seconds >> Complete requests: 270 >> Failed requests:43 >>(Connect: 0, Receive: 0, Length: 43, Exceptions: 0) >> Keep-Alive requests:0 >> Total transferred: 1856249 bytes >> HTML transferred: 1737989 bytes >> *Requests per second:2.33 [#/sec] (mean)* >> *Time per request: 38566.756 [ms] (mean)* >> *Time per request: 428.520 [ms] (mean, across all concurrent >> requests)* >> *Transfer rate: 15.67 [Kbytes/sec] received* >> >> Connection Times (ms) >> min mean[+/-sd] median max >> >> >> *WINDOWS GENERIC WEB2PY APP FROM WEB2PY.EXE* >> C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 >> 10.51.130.53:8080/welcome/default/inde >> x >> This is ApacheBench, Version 2.3 <$Revision: 1748469 $> >> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ >> Licensed to The Apache Software Foundation, http://www.apache.org/ >> >> Benchmarking 1
Re: [web2py] Re: Web2py freezing
[Fri Oct 21 18:02:29.083973 2016] [mpm_winnt:notice] [pid 620:tid 320] AH00354: Child: Starting 250 worker threads. This is a ridiculous high number of threads! ;-) If 10 is the magic number try looking at the pool number in your appconfig.ini. If you need high concurrency try avoiding threads and use processes, unless you are prepared to avoid mutexes anywhere in your code. So you may look into using uwsgi, gunicorn or other webservers that can fork instead of threading. Uwsgi can be used alone or coupled with nginx. The latter if you need to serve lots of static contents. Keep in mind that *real* concurrency is bound to the number of available cores of your CPUs if you use too many threads and/or too many processes you are going to have troubles if there is any resource contention, synchronization, happening If all of the above does not work, try using a Linux distribution... and if that problem persists, you need to show us the code! ciao, mic 2016-10-25 8:56 GMT+02:00 piero crisci : > Hi massimo and thanks fot the hint > I tried with rocket from cmd line and this is result from Apache ab > command line. > I got the same result i have with APACHE WSGI as you can see below > > > *MY APP WITH ROCKET * > This is the command launch > C:\web2py>python web2py.py > *No handlers could be found for logger "web2py"* > web2py Web Framework > Created by Massimo Di Pierro, Copyright 2007-2016 > *Version 2.14.3-stable+timestamp.2016.03.26.23.02.0*2 > Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000 > please visit: > http://10.51.130.53/ > starting browser... > please visit: > http://10.51.130.53:8080/ > starting browser... > > > C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 10.51.130.53:8080/Prototipo_ > RCG/defaul > t/index > This is ApacheBench, Version 2.3 <$Revision: 1748469 $> > Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ > Licensed to The Apache Software Foundation, http://www.apache.org/ > > Benchmarking 10.51.130.53 (be patient) > Completed 100 requests > Completed 200 requests > Finished 270 requests > > > Server Software:Rocket > Server Hostname:10.51.130.53 > Server Port:8080 > > Document Path: /Prototipo_RCG/default/index > Document Length:6437 bytes > > Concurrency Level: 90 > Time taken for tests: 115.700 seconds > Complete requests: 270 > Failed requests:43 >(Connect: 0, Receive: 0, Length: 43, Exceptions: 0) > Keep-Alive requests:0 > Total transferred: 1856249 bytes > HTML transferred: 1737989 bytes > *Requests per second:2.33 [#/sec] (mean)* > *Time per request: 38566.756 [ms] (mean)* > *Time per request: 428.520 [ms] (mean, across all concurrent > requests)* > *Transfer rate: 15.67 [Kbytes/sec] received* > > Connection Times (ms) > min mean[+/-sd] median max > > > *WINDOWS GENERIC WEB2PY APP FROM WEB2PY.EXE* > C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 10.51.130.53:8080/welcome/ > default/inde > x > This is ApacheBench, Version 2.3 <$Revision: 1748469 $> > Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ > Licensed to The Apache Software Foundation, http://www.apache.org/ > > Benchmarking 10.51.130.53 (be patient) > Completed 100 requests > Completed 200 requests > Finished 270 requests > > > Server Software:Rocket > Server Hostname:10.51.130.53 > Server Port:8080 > > Document Path: /welcome/default/index > Document Length:11001 bytes > > Concurrency Level: 90 > Time taken for tests: 18.046 seconds > Complete requests: 270 > Failed requests:0 > Keep-Alive requests:0 > Total transferred: 3087180 bytes > HTML transferred: 2970270 bytes > *Requests per second:14.96 [#/sec] (mean)* > *Time per request: 6015.390 [ms] (mean)* > *Time per request: 66.838 [ms] (mean, across all concurrent > requests)* > *Transfer rate: 167.06 [Kbytes/sec] received* > > Connection Times (ms) > min mean[+/-sd] median max > Connect:0 34 127.0 0 516 > Processing: 3046 4541 915.5 41566231 > Waiting: 2035 4114 1126.0 37966231 > Total: 3046 4575 902.1 44846231 > > Percentage of the requests served within a certain time (ms) > 50% 4484 > 66% 4597 > 75% 5082 > 80% 5582 > 90% 6106 > 95% 6137 > 98% 6168 > 99% 6184 > 100% 6231 (longest request) > > *GENERAL APP **WITH LAST VERSION OF WEB2PY **STARTED FROM CODE WEB2PY.PY* > > C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 10.51.130.53:8080/welcome/ > default/index > > This is ApacheBench, Version 2.3 <$Revision: 1748469 $> > Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ > Licensed to The Apache Software Foundation, http://www.apache.org/ > > Benchmarking 10.51.130.53 (be patient) > Completed 100 requests > Completed 200 requests > Finished 270 reques
Re: [web2py] Re: Web2py freezing on live deployment!
Hi Niphlod, what is asking for disasters? Bumping it up to 500? Can you elaborate on why? (I'm all for avoiding disasters given what's been happening!) The server-status page was showing 150 worker threads active, except lots of the seem not to be from proper requests. Here's my post on apachelounge with more details: http://www.apachelounge.com/viewtopic.php?t=5655 Apache since became unresponsive again since, strangely I could still access appadmin via local host, but pages in the main application weren't responding, even from localhost... CPU and memory were both fine. Made me wonder if I'm doing something stupid in something very top-level application-wise (like in a model file or in layout.html), but I would expect an error message in that case. I'll look into clearing sessions, thanks for the tip. On Wed, Nov 20, 2013 at 4:26 PM, Niphlod wrote: > > > On Wednesday, November 20, 2013 3:56:51 PM UTC+1, Andrew Buchan wrote: >> >> 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! >> > Asking for real disasters! Are you sure that there are more than 150 > (default) requests active ? > > >> Also, I leave sessions alone, but should I be clearing them? >> > Yep, you definitely should (as anyone in production) > > >> 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.. >> > > known issue. Upgrade to trunk > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
That's cool, I was just asking about the side project of Niphlod's to look at the pytds so that we could finally have a pure python database adapter. With a pure python adapter, gevent could properly use greenlets to make database queries, thus there would be no blocking on the queries. On Friday, November 15, 2013 10:30:28 AM UTC-7, Andrew Buchan wrote: > > Hi Derek, the install on Apache is running fine and the ajax issue it > threw up I was able to fix as described above. So my problem is solved, but > thanks for checking in again. > I found that after updating to the latest version of web2py, it was easy > to get apache running following the deployment recipes (I skipped the SSL > part) whereas with the older version I had previously, I had to do a few > hacks to get it to work. > I've not done anything since to determine what went wrong with Rocket in > the first place, and to be honest am not able to justify spending time > investigating what went wrong seeing as I have a working alternative (and > been busy trying to make up for lost time!) > > Let me know if you want a copy of my httpd.conf file (anyone). > > > > On Thu, Nov 14, 2013 at 7:18 PM, Derek >wrote: > >> any luck? >> >> >> On Thursday, November 7, 2013 12:26:44 AM UTC-7, Niphlod wrote: >>> >>> 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. >>> >> -- >> 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. >> > > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
Hi Derek, the install on Apache is running fine and the ajax issue it threw up I was able to fix as described above. So my problem is solved, but thanks for checking in again. I found that after updating to the latest version of web2py, it was easy to get apache running following the deployment recipes (I skipped the SSL part) whereas with the older version I had previously, I had to do a few hacks to get it to work. I've not done anything since to determine what went wrong with Rocket in the first place, and to be honest am not able to justify spending time investigating what went wrong seeing as I have a working alternative (and been busy trying to make up for lost time!) Let me know if you want a copy of my httpd.conf file (anyone). On Thu, Nov 14, 2013 at 7:18 PM, Derek wrote: > any luck? > > > On Thursday, November 7, 2013 12:26:44 AM UTC-7, Niphlod wrote: >> >> 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. >> > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
Yes, I've been caught out by that quite a few times! Not a problem with Apached I may add, the wsgi file redirects stdout to show up in the apache error log, but I suppose you could point it anywhere really. On Fri, Nov 8, 2013 at 12:31 PM, Tim Richardson wrote: > 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). >> > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
> > 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). > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
Thanks for the suggestions, gevent looks good but I am indeed using pyodbc and this seems to be working with Apache so I'd rather stick with this for time being. (Note I had to embedd the Python27.dll manifest into pyodbc.pyd to get it to work with Apache). The reason for using ajax in the first place was naivety. At the time I simply looked up how to call a controller function from javascript and read that ajax() was the way to do it, so proceeded with that without understanding the implications. The feature in question is a check list, which I go over with jQuery.each(). If checked: copy the value to a hidden field, and call ajax to insert a record in the database including that field and couple others. Once done, set windows.location to same page to reaload it. The page has a form on it elsewhere, so I didn't want to make this a form as I kept getting a "confirm resubmission" popup (this is going from memory, it was actually written a long time ago). I've now changed it so each() collate all the values into a string (they're ints) and pass to a url which I navigate to with windows.location, that page does the insert and returns back to previous page. No ajax in there whatsoever :-) I'm scouring the code for other places where I may have placed asynchronous calls next to synchronous ones, which will only have worked by "coincidence" up till now... I know, I know. I might just pick up my copy of the pragmatic programmer and throw it at myself. Hard. On Thu, Nov 7, 2013 at 7:26 AM, Niphlod wrote: > 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. > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
Yea, the ajax running synchronously - you provide callbacks because they do run asynchronously. To quote the jQuery book: The* first letter in Ajax stands for "asynchronous,"* meaning that the operation occurs in parallel and the order of completion is not guaranteed. The 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. Just what kind of app do you have that needs to make synchronous requests? Why are you not batching requests and processing async? On Wednesday, November 6, 2013 4:32:54 PM UTC-7, Ricardo Pedroso wrote: > > On Tue, Nov 5, 2013 at 11:53 AM, Andrew Buchan > > wrote: > >> Ok, the IT guy has disabled McAffee's "on access" scan for the folders >> containing web2py stuff as well as python's installation directory. He >> tells me that parts of McAffee other than "on access" scan may still >> interfere but there's not much we can do about that. This hasn't made any >> difference. >> As for the ajax calls, I thought it might be to do with the asynchronous >> calls taking too long when the server is overloaded (and it seems it is >> being hammered intermittently by another application), but I checked my >> web2py_ajax.html file and the ajax function is set to "async: false", so >> there shouldn't be an issue there unless there is some kind of timeout that >> kicks in? >> >> But I was about to post the above when I did some checks on the ajax >> calls, and am a bit confused... >> I have two javascript functions which call ajax: >> >> #Function1: This call displays a check list of 'previous contracts' to >> pick from >> ajax('HubForms/Timesheets/AjaxReturnBlank', [], >> 'PreviousContractListingArea'); >> >> #Function2: Once user has check some items, they click a button to call >> this, which adds all selected contracts to timesheet, then reloads the page. >> jQuery('.PreviousContractCheckbox').each( >> function(index) >> { >> if(this.checked) >> { >> jQuery('#ContractId').val(this.name); >> ajax('HubForms/Timesheets/AjaxAddContractToTimesheet', >> ['ContractId', 'TimesheetId', 'UserId']); >> } >> } >> ); >> a='nothing, just works'; >> window.location='HubForms/Timesheets/ViewTimesheet?Timesheet_Id=15995'; >> location.reload(true); >> >> I temporarily modified the ajax function in web2py_ajax.html to display a >> pop-up, then wait 3 seconds before executing (last 4 lines modified): >> >> function ajax(u,s,t) { >> var query=""; >> for(i=0; i> if(i>0) query=query+"&"; >> >> >> query=query+encodeURIComponent(s[i])+"="+encodeURIComponent(document.getElementById(s[i]).value); >> } >> /*this line: >>jQuery.ajax({type: "POST", url: u, data: query, async: false, >> success: function(msg) { if(t==':eval') eval(msg); else >> document.getElementById(t).innerHTML=msg; } }); >> replaced by these 4 lines: >> */ >> alert('hi'); >> setTimeout(function(){ >> jQuery.ajax({type: "POST", url: u, data: query, async: false, success: >> function(msg) { if(t==':eval') eval(msg); else >> document.getElementById(t).innerHTML=msg; } }) >> },3000); >> } >> >> The funny thing is that my Function1 does this (says 'hi' then pauses for >> 3 seconds), but Function2 says 'hi' for every item selected as you'd >> expect, but does NOT pause... >> This is making me wonder whether web2py's ajax function behaves >> differently when called from inside jQuery().each() as the setTimeout() >> is being ignored...? >> > > I don't have a solution for your problem, if you could make a minimal > application that replicates the problem, it would > be easy to track it down. > > setTimeout will not pause javascript execution, it will only put the given > function in a "queue" to be processed later. > > Why are you doing an ajax call for each item checked? > I think you could just make one ajax call with a list of checked items, it > would be more efficient. > -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
On Tue, Nov 5, 2013 at 11:53 AM, Andrew Buchan wrote: > Ok, the IT guy has disabled McAffee's "on access" scan for the folders > containing web2py stuff as well as python's installation directory. He > tells me that parts of McAffee other than "on access" scan may still > interfere but there's not much we can do about that. This hasn't made any > difference. > As for the ajax calls, I thought it might be to do with the asynchronous > calls taking too long when the server is overloaded (and it seems it is > being hammered intermittently by another application), but I checked my > web2py_ajax.html file and the ajax function is set to "async: false", so > there shouldn't be an issue there unless there is some kind of timeout that > kicks in? > > But I was about to post the above when I did some checks on the ajax > calls, and am a bit confused... > I have two javascript functions which call ajax: > > #Function1: This call displays a check list of 'previous contracts' to > pick from > ajax('HubForms/Timesheets/AjaxReturnBlank', [], > 'PreviousContractListingArea'); > > #Function2: Once user has check some items, they click a button to call > this, which adds all selected contracts to timesheet, then reloads the page. > jQuery('.PreviousContractCheckbox').each( > function(index) > { > if(this.checked) > { > jQuery('#ContractId').val(this.name); > ajax('HubForms/Timesheets/AjaxAddContractToTimesheet', > ['ContractId', 'TimesheetId', 'UserId']); > } > } > ); > a='nothing, just works'; > window.location='HubForms/Timesheets/ViewTimesheet?Timesheet_Id=15995'; > location.reload(true); > > I temporarily modified the ajax function in web2py_ajax.html to display a > pop-up, then wait 3 seconds before executing (last 4 lines modified): > > function ajax(u,s,t) { > var query=""; > for(i=0; i if(i>0) query=query+"&"; > > > query=query+encodeURIComponent(s[i])+"="+encodeURIComponent(document.getElementById(s[i]).value); > } > /*this line: >jQuery.ajax({type: "POST", url: u, data: query, async: false, > success: function(msg) { if(t==':eval') eval(msg); else > document.getElementById(t).innerHTML=msg; } }); > replaced by these 4 lines: > */ > alert('hi'); > setTimeout(function(){ > jQuery.ajax({type: "POST", url: u, data: query, async: false, success: > function(msg) { if(t==':eval') eval(msg); else > document.getElementById(t).innerHTML=msg; } }) > },3000); > } > > The funny thing is that my Function1 does this (says 'hi' then pauses for > 3 seconds), but Function2 says 'hi' for every item selected as you'd > expect, but does NOT pause... > This is making me wonder whether web2py's ajax function behaves > differently when called from inside jQuery().each() as the setTimeout() > is being ignored...? > I don't have a solution for your problem, if you could make a minimal application that replicates the problem, it would be easy to track it down. setTimeout will not pause javascript execution, it will only put the given function in a "queue" to be processed later. Why are you doing an ajax call for each item checked? I think you could just make one ajax call with a list of checked items, it would be more efficient. -- 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/groups/opt_out.
Re: [web2py] Re: Web2py freezing on live deployment!
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. On Wed, Nov 6, 2013 at 5:28 PM, Derek wrote: > Check the logs, find the last line in the log - that's probably what > caused the freeze. Check your logging.conf to find out where the logs are > kept. > > > On Tuesday, November 5, 2013 1:59:43 PM UTC-7, Andrew Buchan wrote: >> >> Update: >> >> I made a copy of the web2py installation on a new server (still pointing >> to old database) and eventually got it set it up as a service but it >> still freezes with no errors in web2py or in the event manager... >> >> I'm pretty sure it's a programming error on my part somewhere or a >> migration issue, but I need to be able to find out what it is!!! (people >> are getting tetchy...) >> >> I went back to the original server and tried debugging using winpdb, and >> it seems web2py gets stuck in a perpetual loop. When I pause, it tends to >> stop in the "run" or "listen" methods in rocket.py, or "accept" in >> socket.py (python installation dir), so the thread is running, just in a >> loop and not responding to new requests... >> >> I'm thinking of putting the server onto apache to see if it behaves any >> differently, but if anyone has any bright suggestions on what I can do to >> find out what's going, I'm all ears :-) >> >> >> >> >> >> -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.