2010-06-18 40 views
30

問題:

19/06/10更新:更多證據問題是服務器端。在Windows 7上命令行收到此錯誤(參見下面的完整回溯):當試圖將大文件推送到服務器時,Mercurial客戶端錯誤255和HTTP錯誤404

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)報告了錯誤:

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

錯誤甚至是什麼意思?!唯一的(我可以告訴)這個提交的唯一的東西是文件的大小,類型和文件名。如何確定變更集中的哪個確切文件失敗?如何從存儲庫中刪除損壞的變更集?在另一篇文章中,有人報告使用「mq」擴展來有效地從存儲庫中的歷史記錄中刪除錯誤的變更集,但mq看起來過於複雜,我試圖解決。


背景:

我可以推拉如下:同時使用MacHG和toirtoise HG源文件,目錄,.class文件和一個.jar文件,並從服務器。

我成功地向我的本地存儲庫中第一次添加了6個大的.exe,.dmg等安裝文件(總共大約130Mb)。

在以下提交到我的本地存儲庫中,我刪除(「未跟蹤」/忘記)導致該問題的6個文件,但先前(失敗)的變更集仍然排隊推送到服務器(即我的本地主機試圖推動「添加」,然後「移除」到遠程服務器 - 並與源代碼管理系統的「保持所有歷史」理念保持一致)。

我可以使用Windows PC上的TortoiseHG提交.txt .java文件等。我實際上沒有使用TortoiseHG測試提交或推送相同的大文件。

請幫忙!


設置:

客戶端應用程序= MacHG v0.9.7(SCM 1.5.4),和TortoiseHG v1.0.4(SCM 1.5.4)

服務器= HTTPS,IIS7.5,水銀1.5.4,2.6.5的Python,安裝,使用以下指令:

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

在IIS7.5的CGI處理程序被配置來處理所有動詞(不只是GET,POST和HEAD)。在服務器上

我hgweb.cgi文件如下:

#!/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。在服務器上的配置文件如下:

從我的MacBook在命令行
[collections] 
C:\Mercurial Repositories = C:\Mercurial Repositories 

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

輸出使用-v和--trackback標誌(包括水銀和MacHG安裝):從Windows

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$ 

輸出7主機(只安裝TortoiseHG)試圖在同一文件推到服務器(不同changset,但包含相同的6個文件添加作爲變更從的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有問題?

+3

另一個信息來源是從命令行運行並傳入-v和--traceback標誌: hg -v --traceback push – 2010-06-18 17:41:51

回答

50

通過相同的痛點去了......

在IIS服務器上的默認設置,您將無法大庫推送到服務器,IIS有一個只有4默認的最大請求長度MB,並且CGI腳本的超時時間爲15分鐘,因此無法上傳大文件。 要啓用大文件的上傳(並且這在網上很難找到...),請執行以下操作:
1.在IIS管理器中,單擊網站節點,然後單擊限制...鏈接。
2.然後指定足夠大的連接超時時間(我在此選擇1小時或3600秒)
3.接下來,單擊包含hg的節點(按照安裝過程),然後雙擊CGI
4.爲CGI腳本指定足夠長的時間(例如10小時)

現在編輯C:\ inetpub \ wwwroot \ hg \ web.config,以便在<system.webserver>下有一個新的<security>部分,並且<httpRuntime>規格<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> 

這指定了一個超過6天的http超時,最大上傳限制約爲2 GB。

+2

這對我來說非常合適。感謝您的輸入! – 2010-06-21 13:47:12

+0

感謝您發佈您的解決方案。到目前爲止,我只對其進行了部分測試。迄今爲止這麼好,因爲這個問題並沒有發生得那麼多 - 但它仍然在發生。我將在接下來的幾天測試並儘快發佈我的結果。 – coderunner 2010-06-24 14:55:38

+0

您的解決方案確實有所幫助,但不完全。現在我可以成功地推動大約300Mb,但只能通過Mac OS 10.6.4和Win7上的命令行。在MacHG和TortoiseHG下,300Mb推送失敗。 我測試了一個1.3GB的5000個文件,範圍從1kB到600MB。它失敗了,IIS7.5返回「錯誤502 - 錯誤的網關」。根據IIS文檔,這意味着CGI腳本返回了不正確的HTTP響應。 – coderunner 2010-06-28 06:40:16

6

使用IIS 7作爲服務器的問題相同。試過上面解決了錯誤255問題的解決方案,但仍然得到Errorno 10054大文件。然後,我增加了IIS中的連接超時工作。

更改:網站 - >管理網站 - >高級設置 - >連接限制 - >連接超時。默認值是2分鐘。改變了我的20分鐘,它的工作。

不知道爲什麼這個工作,但似乎Mercurial連接到服務器,需要一段時間來處理較大的文件,然後只發送請求。到那時IIS已經斷開了客戶端。

0

好的,你的解決方案做到了!
我已經有了一個requestLimits標籤是這樣的:
<requestLimits maxUrl="16384" maxQueryString="65536" />
,所以我說maxAllowedContentLength = 「524288000」,以這樣的:
<requestLimits maxUrl="16384" maxQueryString="65536" maxAllowedContentLength ="524288000" />
這做到了!

0

我只是發佈這個爲任何人進入這個線程從搜索。

當通過IIS託管時,目前有一個問題在mercurial python模塊中使用largefiles擴展。如果遇到將大型更改集(或大型文件)通過TortoiseHg推送到IIS的問題,請參閱this post

這個問題最終證明是Python 2.7.3引入的一個錯誤(可能解釋了爲什麼有那麼多未解決的尋找Mercurial問題的人的帖子)。回滾到Python 2.7.2讓我進一步提前(阻塞在30Mb而不是15Mb),但爲了正確地解決問題,我必須安裝IISCrypto實用程序以完全禁用通過SSLv2的傳輸。

+0

這是我的情況的問題。或者至少我也有一個與SSL有關的問題。通過https,連接在發送相同數量的字節後始終強制/突然關閉。通過http推送成功完成(共110MB)。 _python 2.7.12 x64,mercurial 3.9 x64,IIS 7.5 - Win Server 2008 R2_ – bor 2016-08-26 12:27:19

+0

我可以使用IISCrypto解決問題,但必須應用'最佳實踐',因爲僅禁用SSLv2是不夠的。現在通過https推送工作正常。 – bor 2016-08-26 13:52:30

相關問題