尝试将大文件推送到服务器时,Mercurial客户端错误255和HTTP错误404 [英] Mercurial client error 255 and HTTP error 404 when attempting to push large files to server

查看:158
本文介绍了尝试将大文件推送到服务器时,Mercurial客户端错误255和HTTP错误404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

10/06/19更新:更多证据问题在服务器端.在Windows 7命令行上收到此错误(有关完整的追溯,请参见下文):

19/06/10 Update: More evidence problem is server-side. Receiving this error on Windows 7 command line (see below for full traceback):

URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>
    abort: error: An existing connection was forcibly closed by the remote host

当尝试将包含6个大文件(.exe,.dmg等)的变更集推送到我的远程服务器时,我的客户端(MacHG)报告错误:

When attempting to push a changeset that contains 6 large files (.exe, .dmg, etc) to my remote server my client (MacHG) is reporting the error:

推送期间发生错误.Mercurial报告 错误号255:中止:HTTP错误 404:未找到"

"Error During Push. Mercurial reported error number 255: abort: HTTP Error 404: Not Found"

错误甚至是什么意思?关于此提交,唯一(我能说出)的唯一信息是文件的大小,类型和文件名.如何确定变更集中的哪个确切文件失败?如何从存储库中删除损坏的变更集?在另一篇文章中,有人报告使用"mq"扩展名有效地从存储库的历史记录中删除了一个错误的变更集,但是对于我要解决的问题,mq看起来过于复杂.

What does the error even mean?! The only thing unique (that I can tell) about this commit is the size, type, and filenames of the files. How can I determine which exact file within the changeset is failing? How can I delete the corrupt changeset from the repository? In a different post, someone reported using "mq" extensions to effectively delete an erroneous changeset from the history within a repository, but mq looks overly complicated for what I'm trying to solve.

我可以同时使用MacHG和toirtoise HG将以下文件:源文件,目录,.class文件和.jar文件往返于服务器.

I can push and pull the following: source files, directories, .class files and a .jar file to and from the server, using both MacHG and toirtoise HG.

我成功地向本地存储库首次添加了6个大型.exe,.dmg等安装程序文件(总计约130Mb).

I successfully committed to my local repository the addition for the first time the 6 large .exe, .dmg etc installer files (about 130Mb total).

在对本地存储库的以下提交中,我删除了(未跟踪"/忘记)导致问题的6个文件,但是先前(失败)的变更集仍在排队等待推送到服务器(即,我的本地主机是尝试将添加"然后删除"到远程服务器-并与源代码控制系统的保留历史中的一切"理念保持一致.)

In the following commit to my local repository, I removed ("untracked" / forget) the 6 files causing the problem, however the previous (failing) changeset is still queued to be pushed to the server (i.e. my local host is trying to push the "add" and then the "remove" to the remote server - and keep aligned with the "keep everything in history" philosophy of the source control system).

我可以使用Windows PC上的TortoiseHG提交.txt .java文件等.我实际上并没有使用TortoiseHG测试提交或推送相同的大文件.

I can commit .txt .java files etc using TortoiseHG from Windows PCs. I haven't actually testing committing or pushing the same large files using TortoiseHG.

请帮助!

客户端应用程序= MacHG v0.9.7(SCM 1.5.4)和TortoiseHG v1.0.4(SCM 1.5.4)

Client applications = MacHG v0.9.7 (SCM 1.5.4), and TortoiseHG v1.0.4 (SCM 1.5.4)

服务器= HTTPS,IIS7.5,Mercurial 1.5.4,Python 2.6.5,请按照以下说明进行设置:

Server = HTTPS, IIS7.5, Mercurial 1.5.4, Python 2.6.5, setup using these instructions:

http://www.jeremyskinner.co.uk/mercurial-on-iis7 /

在IIS7.5中,将CGI处理程序配置为处理所有动词(不仅是GET,POST和HEAD).

In IIS7.5 the CGI handler is configured to handle ALL verbs (not just GET, POST and HEAD).

我在服务器上的hgweb.cgi文件如下:

My hgweb.cgi file on the server is as follows:

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary

# Path to repo or hgweb config to serve (see 'hg help hgweb')
#config = "/path/to/repo/or/config"

# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb('C:\inetpub\wwwroot\hg\hgweb.config')
wsgicgi.launch(application)

我在服务器上的hgweb.config文件如下:

My hgweb.config file on the server is as follows:

[collections]
C:\Mercurial Repositories = C:\Mercurial Repositories

[web]
baseurl = /hg
allow_push = usernamea
allow_push = usernameb

使用-v和--trackback标志从我的Macbook(安装了Mercurial和MacHG)的命令行中进行输出:

Output from the command line from my macbook (both Mercurial and MacHG installed) using -v and --trackback flags:

macbook15:hgrepos coderunner$ hg -v --traceback push
pushing to https://coderunner:***@hg.mydomain.com.au/hg/hgrepos
searching for changes
3 changesets found
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 50, in _runcatch
    return _dispatch(ui, args)
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 471, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 341, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 522, in _runcommand
    return checkargs()
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 476, in checkargs
    return cmdfunc()
  File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 470, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/Library/Python/2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/mercurial/commands.py", line 2462, in push
    r = repo.push(other, opts.get('force'), revs=revs)
  File "/Library/Python/2.6/site-packages/mercurial/localrepo.py", line 1491, in push
    return self.push_unbundle(remote, force, revs)
  File "/Library/Python/2.6/site-packages/mercurial/localrepo.py", line 1636, in push_unbundle
    return remote.unbundle(cg, remote_heads, 'push')
  File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 235, in unbundle
    heads=' '.join(map(hex, heads)))
  File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 134, in do_read
    fp = self.do_cmd(cmd, **args)
  File "/Library/Python/2.6/site-packages/mercurial/httprepo.py", line 85, in do_cmd
    resp = self.urlopener.open(req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 389, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 502, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 427, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 510, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
abort: HTTP Error 404: Not Found
macbook15:hgrepos coderunner$ 

Windows 7主机(仅安装了TortoiseHG)的输出尝试将相同的文件推送到服务器(不同的changset,但包含与从Macbook推送的变更集相同的6个文件)

Output from Windows 7 host (has only TortoiseHG installed) attempting to push the same files to the server (different changset, but contains the same 6 file additions as the changeset being pushed from the macbook)

c:\repositories\hgrepos>hg -v --traceback push
pushing to https://coderunner:***@hg.mydomain.com.au/hg/hgrepos
searching for changes
1 changesets found
Traceback (most recent call last):
  File "mercurial\dispatch.pyo", line 50, in _runcatch
  File "mercurial\dispatch.pyo", line 471, in _dispatch
  File "mercurial\dispatch.pyo", line 341, in runcommand
  File "mercurial\dispatch.pyo", line 522, in _runcommand
  File "mercurial\dispatch.pyo", line 476, in checkargs
  File "mercurial\dispatch.pyo", line 470, in <lambda>
  File "mercurial\util.pyo", line 401, in check
  File "mercurial\commands.pyo", line 2462, in push
  File "mercurial\localrepo.pyo", line 1491, in push
  File "mercurial\localrepo.pyo", line 1636, in push_unbundle
  File "mercurial\httprepo.pyo", line 235, in unbundle
  File "mercurial\httprepo.pyo", line 134, in do_read
  File "mercurial\httprepo.pyo", line 85, in do_cmd
  File "urllib2.pyo", line 389, in open
  File "urllib2.pyo", line 407, in _open
  File "urllib2.pyo", line 367, in _call_chain
  File "mercurial\url.pyo", line 523, in https_open
  File "mercurial\keepalive.pyo", line 259, in do_open
URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>
abort: error: An existing connection was forcibly closed by the remote host

c:\repositories\hgrepos>

这是一个保持活力的问题? IIS7.5是否有故障? Python 2.6.5有问题吗?

It is a keep-alive issue? Is IIS7.5 at fault? Python 2.6.5 at fault?

推荐答案

经历了相同的痛点...

Went through the same pain points...

使用IIS服务器上的默认设置,您将无法将大型存储库推送到服务器,因为IIS的默认最大请求长度仅为4 MB,CGI脚本的超时为15分钟,因此无法上传大文件. 要启用大文件的上传(这在网络上很难找到…),请执行以下操作:
1.在IIS管理器中,单击网站节点,然后单击限制..."链接.
2.然后指定足够大的连接超时(我在这里选择1小时,即3600秒)
3.接下来,单击包含hg的节点(按照安装过程),然后双击CGI
4.为CGI脚本指定足够长的超时时间(例如10小时)

With the default settings on the IIS server, you will not be able to push large repositories to the server, as IIS has a default maximum request length of only 4 MB, and a timeout for CGI scripts of 15 min, making it impossible to upload large files. To enable the uploading of large files (and this is not easy to find on the web…), do the following:
1. In IIS Manager, click on the web site node, and click the Limits… link.
2. Then specify a connection time-out sufficiently large (I chose 1 hour here, or 3600 seconds)
3. Next, click the node containing hg (as per the installation procedure), then double-click CGI
4. Specify a sufficiently-long time out for CGI scripts (e.g., 10 hours)

现在,编辑C:\ inetpub \ wwwroot \ hg \ web.config,以使其在<system.webserver>下具有一个新的<security>部分,并在<system.web>下具有一个<httpRuntime>规范:

Now, edit C:\inetpub\wwwroot\hg\web.config, so that it has a new <security> section under <system.webserver>, and a <httpRuntime> specification under <system.web>:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
[…]
    <security>
         <requestFiltering>
           <requestLimits maxAllowedContentLength ="2147482624" />
      </requestFiltering>
    </security>
  </system.webServer>
  <system.web>
    <httpRuntime
      executionTimeout="540000" maxRequestLength="2097151"/>
  </system.web>
</configuration>

这指定http超时超过6天,最大上传限制为2 GB.

This specifies an http timeout of a bit more than 6 days, and a maximum upload limit of about 2 GB.

这篇关于尝试将大文件推送到服务器时,Mercurial客户端错误255和HTTP错误404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆