AJAX POST request returning 500 server error.

310 views
Skip to first unread message

Thadeus Burgess

unread,
Oct 22, 2009, 3:28:51 PM10/22/09
to web...@googlegroups.com
I have a controller function that returns a number, representing the seconds until something will happen, this gets returned with JSON.

When using jQuery.ajax() to the URL of this function, it recieves a 503 temporarly unavailable.

However, if I take that same url, and paste it into firefox and send it will respond with the correct response.

Now the thing is, this site is getting quite popular, I have a counter on the page keeping track of an item, when that item counter reaches to 0 it makes an ajax request to get the new time.

Everybody on the page will have the same timer, and so they are all making the ajax request at the same time possibly?

However, watching about 20, not even one went through. I can sit there and refresh firefox over and over again during times the ajax gets called, and my firefox requests always go through.

Anybody have any ideas on what could be causing this?

-Thadeus


mr.freeze

unread,
Oct 22, 2009, 4:01:58 PM10/22/09
to web2py-users
You might try switching the call to jQuery.post and see if you get the
same result. Is there any code you can post?

mdipierro

unread,
Oct 22, 2009, 4:09:19 PM10/22/09
to web2py-users
web2py never returns 503. Are you using apache? It may be running out
of threads or processes.

Massimo

On Oct 22, 2:28 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:

Thadeus Burgess

unread,
Oct 22, 2009, 4:29:35 PM10/22/09
to web...@googlegroups.com
I can post code later tonight when I get home, I can't even make any changes to code until then since it is a personal project.

I will try using a GET request instead, since no data is being passed through post anyways.

It is an apache thing, its just odd I only get it when using ajax. It did not start happening until today when the site received a major influx of new content to track.

There is no way for me to increase threads or processes since this site is on shared hosting :(

-Thadeus
Message has been deleted

mdipierro

unread,
Oct 22, 2009, 9:14:17 PM10/22/09
to web2py-users
Move to postgresql not mysql ;-). If I may, what is the site? I am
curious.

On Oct 22, 7:56 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> It seems as if now, I am not recieving any 503 errors. This must be due to
> the ammount of growth the site recieved in such a short period of time, not
> to mention i'm running it in a shared hosting environment, there is nothing
> I can do except get a dedicated server, or perhaps figure a way to limit the
> requests based on a random timer. For some odd reason, get requests load
> faster, but this could just be a fluke in the environment.
>
> I have been browsing through error tickets, and it seems that since my
> database (sqlite) grew from only 100 tracked items to 1460 tracked items in
> a little over a few hours, every ticket recieved is about migration
> EOFErrors. I will try exporting everything to csv, switching over to mysql,
> and reimporting. Perhaps this will fix some of the performance issues, and
> the EOF errors..
>
> S'Traceback (most recent call last):\n  File "gluon/restricted.py",
> line 184, in restricted\n    exec ccode in environment\n
> File "/home/.idiosyncrasy/thadeusb/
> thadeusb.com/surrenderthebooty/applications/init/models/db.py",
> line 42, in <module>\n    auth.define_tables()
> # creates all needed tables\n
> File "gluon/tools.py", line 601, in define_tables\n
> self.settings.table_permission_name, migrate))\n
> File "gluon/sql.py", line 1130, in define_table\n
> query = t._create(migrate=migrate)\n
> File "gluon/sql.py", line 1501, in _create\n
> sql_fields_old = cPickle.load(tfile)\nEOFError\n'
>
> -Thadeus
>
> On Thu, Oct 22, 2009 at 3:29 PM, Thadeus Burgess <thade...@thadeusb.com>wrote:
>
> > I can post code later tonight when I get home, I can't even make any
> > changes to code until then since it is a personal project.
>
> > I will try using a GET request instead, since no data is being passed
> > through post anyways.
>
> > It is an apache thing, its just odd I only get it when using ajax. It did
> > not start happening until today when the site received a major influx of new
> > content to track.
>
> > There is no way for me to increase threads or processes since this site is
> > on shared hosting :(
>
> > -Thadeus
>

Thadeus Burgess

unread,
Oct 23, 2009, 1:56:25 PM10/23/09
to web...@googlegroups.com
Why do you suggest postgresql? I have done alot of research into the two, and mysql seems to be the more effeciant of the two.

From what I gather, mysql is created to be lightweight, and super fast. Postgresql is created to be feature full and stable.

However, dreamhost does not provide postgresql on their shared hosting, so for now I will have to use mysql.

The site is a web app that tracks fish tanks on gaiaonline.com. Basically, gaia has this mini game called "Booty Grab" (here is more info https://www.gaiaonlinehelp.com/ics/support/KBAnswer.asp?questionID=17), that glows at random times. The only way to find if their glowing, is to go through pages and pages of forums... very boring, annoying, and cpu intensive with all of the flash on one page..

Well... My app will contact gaia, ask it for information on a tank, such as when it will be open, and for how long, it stores this data in the database, and displays hyperlinks when pages are available.

http://surrenderthebooty.thadeusb.com/

Your welcome to sign up if you would like to see the internals.

When attempting to migrate over to mysql, I get an error about key length too long, refer to my other post: http://groups.google.com/group/web2py/browse_thread/thread/27d781db1f180665

mdipierro

unread,
Oct 23, 2009, 2:23:10 PM10/23/09
to web2py-users
This is just my biased opinion:
1) MySQL was fatser than postgresql when it had no transaction
2) MySQL has lots of quirks (like max length for text files, no
multiple alter table in one transaction, and others)
3) MySQL was developed by SUN which was bought by Oracle and it is not
clear what it future is. Some developers have left
4) I use postgresql so I have tested it better
5) There are very large postgresql databases I know of (like the .org
domains database), I cannot say the same for mysql (but it may be my
ignorance).
6) postgresql has autovacuum so you do not need to do much
maintenance.

On Oct 23, 12:56 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Why do you suggest postgresql? I have done alot of research into the two,
> and mysql seems to be the more effeciant of the two.
>
> From what I gather, mysql is created to be lightweight, and super fast.
> Postgresql is created to be feature full and stable.
>
> However, dreamhost does not provide postgresql on their shared hosting, so
> for now I will have to use mysql.
>
> The site is a web app that tracks fish tanks on gaiaonline.com. Basically,
> gaia has this mini game called "Booty Grab" (here is more infohttps://www.gaiaonlinehelp.com/ics/support/KBAnswer.asp?questionID=17), that
> glows at random times. The only way to find if their glowing, is to go
> through pages and pages of forums... very boring, annoying, and cpu
> intensive with all of the flash on one page..
>
> Well... My app will contact gaia, ask it for information on a tank, such as
> when it will be open, and for how long, it stores this data in the database,
> and displays hyperlinks when pages are available.
>
> http://surrenderthebooty.thadeusb.com/
>
> Your welcome to sign up if you would like to see the internals.
>
> When attempting to migrate over to mysql, I get an error about key length
> too long, refer to my other post:http://groups.google.com/group/web2py/browse_thread/thread/27d781db1f...

Thadeus Burgess

unread,
Oct 23, 2009, 3:29:08 PM10/23/09
to web...@googlegroups.com
Could you help me with python-postgres installation?

I installed postgresql, and postgresql-server, they are running, and I can access postgre through phpPgAdmin.

I tried installing psycog2 however I get the following traceback

running build
running build_py
creating build
creating build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/psycopg2
copying lib/tz.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/extensions.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/pool.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/__init__.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/psycopg1.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/extras.py -> build/lib.linux-i686-2.6/psycopg2
copying lib/errorcodes.py -> build/lib.linux-i686-2.6/psycopg2
running build_ext
error: No such file or directory

-Thadeus

Wes James

unread,
Oct 23, 2009, 10:55:35 PM10/23/09
to web...@googlegroups.com
I think in setup.py you need to tell it where pg_config is ????
/usr/local/pgsql/bin/pg_config

something like that if you didn't.

Thadeus Burgess

unread,
Oct 23, 2009, 11:43:59 PM10/23/09
to web...@googlegroups.com
Thanks, got it installed now!

-Thadeus

Yarko Tymciurak

unread,
Oct 24, 2009, 10:22:13 AM10/24/09
to web...@googlegroups.com
Also, you might appreciate pgAdmin-III better (which you can use remotely to administer your pg databases, normally or more securely through a tunnel).

BTW - Pycon conference has used postgres for a while... (not sure how long).
There is a lot of behind the scene processing and data for Pycon (talk submissions, proposals, voting, etc., registration, tutorials, and on and on....)

mr.freeze

unread,
Oct 24, 2009, 1:01:10 PM10/24/09
to web2py-users
Thadeus, were you able to install postgresql on Dreamhost? If so,
could you maybe make a quick slice explaining how you did it or tell
me the steps you took? I too would like to move away from MySQL.

http://www.web2pyslices.com

On Oct 23, 10:43 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Thanks, got it installed now!
>
> -Thadeus
>
> On Fri, Oct 23, 2009 at 9:55 PM, Wes James <compte...@gmail.com> wrote:
>
> > I think in setup.py you need to tell it where pg_config is ????
> > /usr/local/pgsql/bin/pg_config
>
> > something like that if you didn't.
>
> > On Fri, Oct 23, 2009 at 1:29 PM, Thadeus Burgess <thade...@thadeusb.com>
> > wrote:
> > > Could you help me with python-postgres installation?
>
> > > I installed postgresql, and postgresql-server, they are running, and I
> > can
> > > access postgre through phpPgAdmin.
>
> > > I tried installing psycog2 however I get the following traceback
>
> > > running build
> > > running build_py
> > > creating build
> > > creating build/lib.linux-i686-2.6
> > > creating build/lib.linux-i686-2.6/psycopg2
> > > copying lib/tz.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/extensions.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/pool.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/__init__.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/psycopg1.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/extras.py -> build/lib.linux-i686-2.6/psycopg2
> > > copying lib/errorcodes.py -> build/lib.linux-i686-2.6/psycopg2
> > > running build_ext
> > > error: No such file or directory
>
> > > -Thadeus
>
> > > On Fri, Oct 23, 2009 at 1:23 PM, mdipierro <mdipie...@cs.depaul.edu>

Thadeus Burgess

unread,
Oct 24, 2009, 1:57:47 PM10/24/09
to web...@googlegroups.com
Dreamhost does not allow you to install postgres. And if you try, you will get a cease and disist letter from them.

Here is a convo with Jeff

http://forum.dreamhosters.com/offtopic/11085-PostgreSQL-rant.htm

That was back in 04, and they still have the same opinion about it!

-Thadeus
Reply all
Reply to author
Forward
0 new messages