0

我正试图让一个网站再次运行,它失去了一名开发人员和大量无证信息——迫切需要帮助。该站点正在使用以下配置,我的感觉是我没有正确启动cherrypy(cherryd?)。

该站点未使用基于名称的虚拟主机,使用 IP 地址一切正常/运行良好。我们没有使用 mod_python,cherrypy 不是以 apache 开头的。

我们通过.htaccess 中的重写规则将一些请求路由到cherrypy

RewriteRule ^ip/(.*) http://127.0.0.1:8081/$1 [proxy]

配置文件:(cpconfig.conf)

[global]
server.socket_port = 8081

启动cherryd的命令对我不起作用:

cherryd -d -i imageproc -c cpconfig.conf

Cherrypy 似乎开始:

ENGINE Listening for SIGHUP.
ENGINE Listening for SIGTERM.
ENGINE Listening for SIGUSR1.
ENGINE Bus STARTING
ENGINE Started monitor thread '_TimeoutMonitor'.
ENGINE Started monitor thread 'Autoreloader'.
ENGINE Serving on 127.0.0.1:8081
ENGINE Bus STARTED

我们的大多数应用程序都可以正常工作。该应用程序是一种设计工具,它使用输入和图像上传来在屏幕上呈现图像。文本输入工作正常。但是,当我们使用应用程序的文件上传部分时,文件似乎正在上传(根据 chrome 的进度指示器),然后它只是等待、超时并最终返回 502 代理错误?

在此等待/超时期间,我可以使用其他文本输入等,并且cherrypy 服务器快速响应.. 它只是在图像上窒息。

这是 Apache 显示的内容。长编码 URL 表示对画布上图像的更改,所有这些都返回 OK。但是随后文件上传失败..

[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(1513): [client 67.176.56.45] proxy: *: found reverse proxy worker for http://127.0.0.1:8081/render?w=805&h=470&z=0.2&l=%5B%7B%22t%22%3A%2233%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%5D&g=%5B%5D&b=, referer: http://97.107.141.248/design/new/1209
[Tue Jan 22 19:56:11 2013] [debug] mod_proxy.c(993): Running scheme http handler (attempt 0)
[Tue Jan 22 19:56:11 2013] [debug] mod_proxy_http.c(1940): proxy: HTTP: serving URL http://127.0.0.1:8081/render?w=805&h=470&z=0.2&l=%5B%7B%22t%22%3A%2233%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%5D&g=%5B%5D&b=
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(1999): proxy: HTTP: has acquired connection for (*)
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(2055): proxy: connecting http://127.0.0.1:8081/render?w=805&h=470&z=0.2&l=%5B%7B%22t%22%3A%2233%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%5D&g=%5B%5D&b= to 127.0.0.1:8081
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(2153): proxy: connected /render?w=805&h=470&z=0.2&l=%5B%7B%22t%22%3A%2233%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%2C%7B%22t%22%3A%22%22%2C%22b%22%3Afalse%2C%22i%22%3Afalse%2C%22u%22%3Afalse%2C%22a%22%3A%22c%22%2C%22fs%22%3A11%2C%22f%22%3A0%2C%22x%22%3A0%2C%22y%22%3A0%2C%22arc%22%3Afalse%2C%22o%22%3A0%2C%22r%22%3A0%2C%22cw%22%3Atrue%7D%5D&g=%5B%5D&b= to 127.0.0.1:8081
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(2308): proxy: HTTP: fam 2 socket created to connect to *
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(2414): proxy: HTTP: connection complete to 127.0.0.1:8081 (127.0.0.1)
[Tue Jan 22 19:56:11 2013] [debug] mod_proxy_http.c(1723): proxy: start body send
[Tue Jan 22 19:56:11 2013] [debug] mod_proxy_http.c(1816): proxy: end body send
[Tue Jan 22 19:56:11 2013] [debug] proxy_util.c(2017): proxy: HTTP: has released connection for (*)
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(1513): [client 67.176.56.45] proxy: *: found reverse proxy worker for http://127.0.0.1:8081/upload, referer: http://97.107.141.248/design/new/1209
[Tue Jan 22 19:56:21 2013] [debug] mod_proxy.c(993): Running scheme http handler (attempt 0)
[Tue Jan 22 19:56:21 2013] [debug] mod_proxy_http.c(1940): proxy: HTTP: serving URL http://127.0.0.1:8081/upload
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(1999): proxy: HTTP: has acquired connection for (*)
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(2055): proxy: connecting http://127.0.0.1:8081/upload to 127.0.0.1:8081
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(2153): proxy: connected /upload to 127.0.0.1:8081
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(2308): proxy: HTTP: fam 2 socket created to connect to *
[Tue Jan 22 19:56:21 2013] [debug] proxy_util.c(2414): proxy: HTTP: connection complete to 127.0.0.1:8081 (127.0.0.1)
[Tue Jan 22 20:01:22 2013] [error] [client 67.176.56.45] (70007)The timeout specified has expired: proxy: error reading status line from remote server 127.0.0.1, referer: http://97.107.141.248/design/new/1209
[Tue Jan 22 20:01:22 2013] [debug] mod_proxy_http.c(1401): [client 67.176.56.45] proxy: read timeout, referer: http://97.107.141.248/design/new/1209
[Tue Jan 22 20:01:22 2013] [error] [client 67.176.56.45] proxy: Error reading from remote server returned by /ip/upload, referer: http://97.107.141.248/design/new/1209
[Tue Jan 22 20:01:22 2013] [debug] proxy_util.c(2017): proxy: HTTP: has released connection for (*)

如果有更好的方式来传达日志,请让我知道什么是首选..

不管怎样,8081上没有别的东西在听……

这是否表明应用程序本身存在与图像上传有关的某种错误?我已经尝试将应用程序代码恢复到一切正常的时间点,按照上述(cherryd)杀死并重新启动cherrypy,但它仍然无法正常工作。

新信息: 像这样运行我的应用程序:python imageproc.py

有诀窍,因为我的应用程序中有一个快速启动调用。没有端口问题,图像将上传,一切正常。但是当然关闭术语窗口会终止该过程。所以我仍在寻找正确的方法来让cherrypy离开地面。

就像我说的迫切需要任何指针..谢谢

4

2 回答 2

0

很可能您的图像大小大于 CherryPy 设置的默认允许请求实体大小(即 100Mb IIRC)。

当请求实体大于阈值时,CherryPy 中止请求并返回 413 错误代码。

尝试在全局配置中设置以下值:

[global]
server.max_request_body_size = 20971520000

这会将其设置为 200Mb。

编辑:这是将 CherryPy 进程变成守护进程的方法:

import cherrypy

class Root(object):
    @cherrypy.expose
    def index(self):
        return "hello world"

if __name__ == '__main__':
    cherrypy.config.update({'server.socket_port': 8081,
                            'server.socket_host': '0.0.0.0'})

    from cherrypy.process.plugins import Daemonizer
    cherrypy.config.update({'log.screen': False})
    Daemonizer(cherrypy.engine).subscribe()

    cherrypy.quickstart(Root())
于 2013-01-23T13:26:53.713 回答
0

我正在回答这个问题,因为我剩下的唯一问题与原始问题无关。

我的应用程序调用了cherrypy.quickstart,所以我只需要启动我的应用程序:

python appname.py&

所以使用cherryd是错误的方法,并导致上面提到的奇怪的端口/代理相关错误。

作为一个新手,我花了一段时间才弄清楚在我的命令末尾添加“&”会在后台运行我的应用程序,这样我就可以关闭我的终端窗口。

这种组合使我能够在事情破裂之前回到我们在这个项目中的位置。

我剩下的问题是关于保持cherrypy服务启动并使用cron运行,但这是一个单独的问题,我将进一步研究..

于 2013-01-23T18:49:28.320 回答