Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #243 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] CherryPy server crashes when Kid template is changed

Reported by: egor@… Owned by: anonymous
Priority: normal Milestone: 0.9
Component: CherryPy Version:
Severity: major Keywords: autoreload
Cc:

Description

When I run in debug mode with autoreload enabled CherryPy? server sometimes crashes without any traceback when Kid template is changed on disk.

2005/12/20 17:06:55 HTTP INFO 192.168.47.1 - GET / HTTP/1.1
2005-12-20 17:06:55,383 turbogears.view DEBUG Recompiling template for turbogears.fastdata.templates.sitetemplate
2005-12-20 17:06:55,384 turbogears.view DEBUG Recompiling template for yawpanel.templates.domainlist
2005-12-20 17:06:55,396 turbogears.view DEBUG Applying template yawpanel.templates.domainlist
192.168.47.1 - - [2005/12/20 17:06:55] "GET / HTTP/1.1" 200 1024
2005/12/20 17:06:55 HTTP INFO 192.168.47.1 - GET /static/css/main.css HTTP/1.1
192.168.47.1 - - [2005/12/20 17:06:55] "GET /static/css/main.css HTTP/1.1" 304 -
2005/12/20 17:06:55 HTTP INFO 192.168.47.1 - GET /tg_static/images/tg_under_the_hood.png HTTP/1.1
192.168.47.1 - - [2005/12/20 17:06:55] "GET /tg_static/images/tg_under_the_hood.png HTTP/1.1" 304 -
2005/12/20 17:06:58 HTTP INFO SystemExit raised: shutting down autoreloader
2005/12/20 17:06:58 HTTP INFO HTTP Server shut down
2005/12/20 17:06:58 HTTP INFO CherryPy shut down
2005/12/20 17:06:58 CONFIG INFO Server parameters:
2005/12/20 17:06:58 CONFIG INFO   server.environment: development
2005/12/20 17:06:58 CONFIG INFO   server.logToScreen: True
2005/12/20 17:06:58 CONFIG INFO   server.logFile:
2005/12/20 17:06:58 CONFIG INFO   server.protocolVersion: HTTP/1.0
2005/12/20 17:06:58 CONFIG INFO   server.socketHost:
2005/12/20 17:06:58 CONFIG INFO   server.socketPort: 8080
2005/12/20 17:06:58 CONFIG INFO   server.socketFile:
2005/12/20 17:06:58 CONFIG INFO   server.reverseDNS: False
2005/12/20 17:06:58 CONFIG INFO   server.socketQueueSize: 5
2005/12/20 17:06:58 CONFIG INFO   server.threadPool: 0
2005/12/20 17:06:58 HTTP INFO Serving HTTP on http://localhost:8080/
2005/12/20 17:07:01 HTTP INFO 192.168.47.1 - GET / HTTP/1.1
2005-12-20 17:07:01,189 turbogears.view DEBUG Recompiling template for turbogears.fastdata.templates.sitetemplate
2005-12-20 17:07:01,191 turbogears.view DEBUG Recompiling template for yawpanel.templates.domainlist
2005-12-20 17:07:01,202 turbogears.view DEBUG Applying template yawpanel.templates.domainlist
192.168.47.1 - - [2005/12/20 17:07:01] "GET / HTTP/1.1" 200 1023
2005/12/20 17:07:01 HTTP INFO 192.168.47.1 - GET /static/css/main.css HTTP/1.1
192.168.47.1 - - [2005/12/20 17:07:01] "GET /static/css/main.css HTTP/1.1" 304 -
2005/12/20 17:07:01 HTTP INFO 192.168.47.1 - GET /tg_static/images/tg_under_the_hood.png HTTP/1.1
192.168.47.1 - - [2005/12/20 17:07:01] "GET /tg_static/images/tg_under_the_hood.png HTTP/1.1" 304 -
2005/12/20 17:07:04 HTTP INFO SystemExit raised: shutting down autoreloader
2005/12/20 17:07:04 HTTP INFO HTTP Server shut down
2005/12/20 17:07:04 HTTP INFO CherryPy shut down
2005/12/20 17:07:04 HTTP INFO SystemExit raised: shutting down autoreloader
2005/12/20 17:07:04 HTTP INFO CherryPy shut down
egor@debian2:~/tg/yawpanel$

Running TurboGears 0.9a0dev-r346 on Linux, Python 2.4.2

Attachments

template-autoreload.patch Download (2.1 KB) - added by egor@… 13 years ago.

Change History

comment:1 Changed 13 years ago by egor@…

  • Summary changed from CherryPy server crashes when Kid template is changed to [PATCH ]CherryPy server crashes when Kid template is changed

Though I haven't understood why TurboGears crashed, I found a bug in autoreload logic. Kid templates was never reloaded in view.py however some reload logic is present in lookupTemplate() function:

        if ct.has_key(classname):
            mtime = os.stat(tfile).st_mtime
            if ct[classname] != mtime:
                del sys.modules[classname]
            ct[classname] = mtime

At the same time Kid templates are affected by CherryPy? autoreloader, but they should be reloaded in view.py. Patch that solves both issues is attached.

Changed 13 years ago by egor@…

comment:2 Changed 13 years ago by anonymous

  • Summary changed from [PATCH ]CherryPy server crashes when Kid template is changed to [PATCH] CherryPy server crashes when Kid template is changed

comment:3 Changed 13 years ago by egor@…

  • Status changed from new to assigned

comment:4 Changed 13 years ago by kevin

  • Status changed from assigned to closed
  • Resolution set to fixed

committed in [360] thanks!

Note: See TracTickets for help on using tickets.