Long delay at startup & a couple of problems

0 views
Skip to first unread message

Paul Johnston

unread,
Nov 26, 2006, 6:46:14 AM11/26/06
to TurboGears
Hi,

I've just been getting to grips with Turbogears and it's going great for
me. Just been having a few problems, which I hope someone here can help
me with.

1) A long delay (~40s) at startup. When I run start-wiki20.py, these are
the last two lines of output:
2006-11-26 11:30:50,562 cherrypy.msg INFO CONFIG: server.thread_pool: 10
2006-11-26 11:31:31,687 cherrypy.msg INFO HTTP: Serving HTTP on
http://localhost:8080/
(notice the long gap). I'm just using the default sqlite database. I
have a reasonable pc (Athlon XP 2800, 1 gb) and the computer appears
idle during the time.

2) Trying to use Cheetah templates, I get lots of "name not found"
errors, for example the display() method on widgets. They work fine in
Kid. I wonder if this is a namemapper issue, I did notice a warning in
the output:

You don't have the C version of NameMapper installed! I'm disabling
Cheetah's useStackFrames option as it is painfully slow with the Python
version of NameMapper. You should get a copy of Cheetah with the
compiled C version of NameMapper.

I had a go at installing _namemapper.pyd, which seemed to get rid of
that warning message, but not the "name not found" errors!

3) With tgadmin sql I'm getting some sqlite errors (below) but it does
seem to perform the correct operations.
Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
object has no attribute 'autocommit'" in <bound method
Transaction.__del__ of <sqlobject.dbconnection.Transaction object at
0x015C78F0>> ignored

4) There seems to be a bug in Catwalk, related to tables with joins.
Once a table that has a MultipleJoin had a child row created, it's no
longer possible to browse the parent table.

5) There is a minor bug in MSSQL support. You can only create one
database connection per Python instance, due to it's use of the
"sqlmodule" global variable internally. Not a problem for most apps, but
this really got me as I was figuring out the connection URL format.

Anyway, I hope these bug reports help, and I really hope someone can
help me, particularly with (1).

Cheers,

Paul

Gregor Horvath

unread,
Nov 26, 2006, 7:39:12 AM11/26/06
to turbo...@googlegroups.com
Paul Johnston schrieb:

>
> 1) A long delay (~40s) at startup. When I run start-wiki20.py, these are
> the last two lines of output:
> 2006-11-26 11:30:50,562 cherrypy.msg INFO CONFIG: server.thread_pool: 10
> 2006-11-26 11:31:31,687 cherrypy.msg INFO HTTP: Serving HTTP on
> http://localhost:8080/
> (notice the long gap). I'm just using the default sqlite database. I
> have a reasonable pc (Athlon XP 2800, 1 gb) and the computer appears
> idle during the time.

Do you have a network connection?
I notice this delay when there is no network.

--
Gregor


Stuart Clarke

unread,
Nov 26, 2006, 8:14:13 AM11/26/06
to turbo...@googlegroups.com

I also experience seriously long delays when starting my app without an
Internet connection.

Stuart

Paul Johnston

unread,
Nov 26, 2006, 9:08:46 AM11/26/06
to turbo...@googlegroups.com
Hi,

>>1) A long delay (~40s) at startup. When I run start-wiki20.py, these are
>>the last two lines of output:
>>
>>

>Do you have a network connection?
>I notice this delay when there is no network.
>
>

Yes, my computer is connected to the Internet, via a wireless NIC and a
router. The computer also has a couple of wired cards, neither enabled
at the moment. It is running Windows Firewall and ICS.

I wonder if this is a failing DNS lookup, or something. I ran Ethereal
while starting Turbogears, and it didn't generate any packets (and the
caputre was working, e.g. browsing is captured).

Is there some way I can increase the debugging in CherryPy, to narrow
down where the delay is happening?

Thanks for your help,

Paul

Jorge Vargas

unread,
Nov 26, 2006, 9:50:52 AM11/26/06
to turbo...@googlegroups.com
On 11/26/06, Paul Johnston <p...@pajhome.org.uk> wrote:
>
> Hi,

>
> 1) A long delay (~40s) at startup. When I run start-wiki20.py, these are
> the last two lines of output:
> 2006-11-26 11:30:50,562 cherrypy.msg INFO CONFIG: server.thread_pool: 10
> 2006-11-26 11:31:31,687 cherrypy.msg INFO HTTP: Serving HTTP on
> http://localhost:8080/
> (notice the long gap). I'm just using the default sqlite database. I
> have a reasonable pc (Athlon XP 2800, 1 gb) and the computer appears
> idle during the time.
>
this may be the autoreload function try turining that off in the config.

> 3) With tgadmin sql I'm getting some sqlite errors (below) but it does
> seem to perform the correct operations.
> Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
> object has no attribute 'autocommit'" in <bound method
> Transaction.__del__ of <sqlobject.dbconnection.Transaction object at
> 0x015C78F0>> ignored

this is one of those "noone really knows what's happening issue" do a
search on the wiki for


"'pysqlite2.dbapi2.Connection' object has no attribute 'autocommit'"

or in google there is a wiki page on trac with this.

> 5) There is a minor bug in MSSQL support. You can only create one
> database connection per Python instance, due to it's use of the
> "sqlmodule" global variable internally. Not a problem for most apps, but
> this really got me as I was figuring out the connection URL format.

you may want to redirect that to the SO list, the maintainer of the
module could reply.

Christopher Arndt

unread,
Nov 26, 2006, 12:02:22 PM11/26/06
to turbo...@googlegroups.com
Paul Johnston schrieb:

> 2) Trying to use Cheetah templates, I get lots of "name not found"
> errors, for example the display() method on widgets. They work fine in
> Kid. I wonder if this is a namemapper issue, I did notice a warning in
> the output:

This is a Cheetah bug, related to the auto-calling feature of the namemapper:

http://sourceforge.net/mailarchive/message.php?msg_id=30070548


For a workaround, see my Cheetah custom filter here:

http://docs.turbogears.org/1.0/AdvancedCheetahTemplates#the-template-base-class


Alternatively, you could probably just turn off auto-calling completely (untested).

Chris

Paul Johnston

unread,
Nov 26, 2006, 2:35:32 PM11/26/06
to turbo...@googlegroups.com
Hi,

>>>1) A long delay (~40s) at startup. When I run start-wiki20.py, these are
>>>the last two lines of output:
>>>

>>o you have a network connection?
>>I notice this delay when there is no network.
>>
>>
>I also experience seriously long delays when starting my app without an
>Internet connection.
>
>

I took a look into CherryPy and found that the slow call is in
_cpwsgiserver.py

info = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)

In my setup it's getting called with host="" port=8080. This call takes
about 40s on its own. If I use None instead of "" it returns
immediately. The results are slightly different:

host = None
[(2, 1, 0, '', ('127.0.0.1', 8080))]
host = ""
[(2, 1, 0, '', ('192.168.2.100', 8080))]

So, my first attemt at this is to add the following line to
_cpwsgiserver.py, just before socket.getaddrinfo
if not host: host = None

With this tweak my Turbogears apps start up much quicker! I'm not sure
if this fix is the best fix (hopefully someone more knowledgeable of TG
will read this), but it does seem to work.

Hope this helps someone,

Paul

Dax

unread,
Nov 30, 2006, 12:39:47 AM11/30/06
to TurboGears
Paul,

I'm new to Cheetah so this question may seem lame. :-) How did you
install the _namemapper.pyd file. I downloaded it from Cheetah but
don't know how to install it. Cheetah made it seem all I had to do was
to copy it to the root Cheetah folder. BTW, I'm using Python 2.5 on
Windows.

Thanks,
Dax

Reply all
Reply to author
Forward
0 new messages