Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read anaconda-mode server response #360

Open
ziyangli opened this issue Jun 19, 2019 · 9 comments
Open

Cannot read anaconda-mode server response #360

ziyangli opened this issue Jun 19, 2019 · 9 comments

Comments

@ziyangli
Copy link

ziyangli commented Jun 19, 2019

I have checked there are similar issues, but no solutions are given. Hope somebody can help me fix this problem.

# status: (:error (error http 504))
# point: 273
HTTP/1.1 504 Gateway Time-out
Server: squid/2.7.STABLE9
Date: Wed, 19 Jun 2019 03:20:49 GMT
Content-Type: text/html
Content-Length: 2446
X-Squid-Error: ERR_CONNECT_FAIL 111
X-Cache: MISS from SK-SQUIDWEB-82
X-Cache-Lookup: MISS from SK-SQUIDWEB-82:8080
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<meta http-equiv="pragma" content="no-cache">
		<LINK media="screen" href="http://access-proxy.oa.com/squid/css/maintemp.css" type="text/css" rel="stylesheet">
		<LINK media="screen" href="http://access-proxy.oa.com/squid/css/localtemp.css" type="text/css" rel="stylesheet">
	    </HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<div class="header">
				<div class="real-wrap">
					<div class="site-logo"><img src="http://access-proxy.oa.com/squid/Images/6_r1_c1.jpg"></div>
				</div>
			</div>
			<div class="maincontent" >
				<div class="real-wrap" style="width:800px;">
					<div class="loginpanel" >
						<ul class="qll">
							<li>
								<div style="font-size:12px;">
                                    <img style="position:relative;top:70px;left:50px;" src="http://access-proxy.oa.com/squid/Images/error.png"></img>
                                    <div style="position:relative;top:-50px;left:260px;">
                                        <p>IT</p>
                                        <p>ID500</p>
                                        <p> http://127.0.0.1:32879/</p>
                                        <p>SK-SQUIDWEB-82</p>
                                        <p>8000</p>
									</div>
								</div>
                                <br />

								<h3></h3>
									<div style="text-align:left">
										&&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://access-proxy.oa.com/squid/Images/1.jpg">CE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://access-proxy.oa.com/squid/Images/2.jpg">IT
									</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="footer">
				<div class="real-wrap">
					<p>Copyright &#169; 1998 - 2018 TENCENT. All Rights Reserved.</p>
				</div>
			</div>
		</form>
	</body>
</HTML>
</BODY></HTML>
@AlexLewandowski
Copy link

You could try the fork by @falloutphil referenced in #335 (recently merged then reverted).

@falloutphil
Copy link
Contributor

Hi @ziyangli - can you explain exact steps on how to recreate this issue? It's strange that you're getting a timeout error rather than a concrete refusal, but I'd need more details on the remote connection and the operation you are doing before I can comment.

Can you also confirm if you experience problems on the current version in MELPA (which does not contain my latest merge)?

@ziyangli
Copy link
Author

ziyangli commented Jun 21, 2019

@falloutphil ,thank you for your reply.

I am running the latest Emacs and anaconda-mode on a newly installed ubuntu18.04 in Vmware. No special steps. I just open a python file and then get this error message. In fact I guess the reason could be related to my proxy settings, which looks like this:

(setq url-proxy-services
      '(
        ("no_proxy" . "localhost,127.0.0.1")
        ("http" . "secret-proxy")
        ("https" . "secret-proxy")))

@ziyangli
Copy link
Author

ziyangli commented Jun 21, 2019

I comment out the proxy settings above and now anaconda mode works. So indeed the reason is my proxy setting. Does anybody know how to correctly use the proxy since I still need the proxy to update packages.

@falloutphil
Copy link
Contributor

falloutphil commented Jun 21, 2019

Thanks for the extra info @ziyangli.

First thing when you say you open a Python file - so I'm 100% clear - this is a remote Python file, opened using Tramp, from an emacs session running on your vmware Ubuntu 18.04 server, and not a local Python file stored locally on your vmware Ubuntu server?

Sorry it's an obvious question - but essential to be certain what is happening!

Assuming you are opening a remote file as I describe above, I have a good idea what this might be:

  • This "worked" originally because the SSH tunnel creation was failing and the RPC requests were being sent directly to the remote host using emacs own http libraries - which I assume adheres to emacs' HTTP proxy settings.
  • Now all traffic is correctly being pushed through the tunnel, but in your case this is probably failing because the tunnel is somehow blocked. You might be able to see this in *anaconda-ssh* buffer?

So the reason it originally worked with your HTTP proxy, was actually a bug in the code that I have fixed! Although this doesn't help you much!

Nevertheless, I think it's possible to support both.

Outside of emacs - i.e. from the Ubuntu vmware terminal, exactly how would you SSH onto your remote server where the Python files are stored? Are you using a proxy for this, for example? If you don't mind giving me the command line and/or any relevant bits from your SSH config file that will help me better understand the problem I have a much better chance of offering a good solution

The problem probably is that the HTTP RPC request will no longer go through your HTTP Proxy, and instead is traveling through the SSH tunnel to the remote server. Either the tunnel is not being created, or the remote server is not routing the HTTP traffic correctly, but it's hard to know exactly what.

The most straightforward, but insecure fix is have a "No Proxy For Remote RPC" custom setting, which simply doesn't create an SSH tunnel at all, and attempts a direct HTTP connection - mimicking exactly what the old code was doing.

I can implement this easy enough, but like I said it's not secure and packets will travel in cleartext across the internet.

A better solution is to diagnose exactly what is the problem in your case and perhaps add further configuration to handle more complicated proxy cases.

@CeleritasCelery
Copy link
Contributor

@ziyangli is this issue still present?

@haystack-ia
Copy link

@ziyangli I just fixed a very similar issue.

IME, proxy settings work better in emacs if you set the http_proxy, https_proxy, and no_proxy vars as environment variables instead of as emacs variables. Adding localhost and 127.0.0.1 to the no_proxy value in /etc/environment just fixed this for me.

@NightMachinery
Copy link

@haystack-ia commented on Mar 12, 2020, 5:21 PM GMT+3:30:

@ziyangli I just fixed a very similar issue.

IME, proxy settings work better in emacs if you set the http_proxy, https_proxy, and no_proxy vars as environment variables instead of as emacs variables. Adding localhost and 127.0.0.1 to the no_proxy value in /etc/environment just fixed this for me.

What exactly do you set no-proxy to? Does it need to be set on emacs' starting environment, or on the remote machine?

@CeleritasCelery
Copy link
Contributor

@NightMachinary no_proxy should include anaconda-mode-localhost-address which defaults to 127.0.0.1. This should be set on your local machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants