JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.86k stars 5.49k forks source link

Unable to resolve DNS within Julia on Windows #5574

Closed mlubin closed 10 years ago

mlubin commented 10 years ago

I'm helping out a user who's experiencing a very strange issue (Windows 8, 64-bit):

julia> ;nslookup github.com
Server: UnKnown
Address: 18.71.[...].[...]

*** UnKnown can't find github.com: No response from server

But pinging github's IP address from within julia works.

The strange part is that if you run the same command in the Git bash that comes with Julia, it works fine:

$ nslookup github.com
Server: [...]
Address: 18.71.[...].[...]

Non-authoritative answer:
Name: github.com
Address: 192.30.252.131

This is an issue with all DNS lookups, not just github. There are no firewalls enabled (that I can find). The same occurs with julia 0.2 and 0.3. This happens on all networks, not just MIT wifi. The internet connection seems to work fine from all applications except julia. How can I debug this?

pao commented 10 years ago

Wireshark?

flashus commented 10 years ago

I am experiencing the same issue (Windows8, now 8.1 x64). Tried run(ping github.com), same error. When I ping it from command line it works. Tried different builds, also build myself, checked firewall settings, nothing helped.

pao commented 10 years ago

Including @drlivip, these all seem to be Windows 8 x64 users?

mlubin commented 10 years ago

Appears so.

quinnj commented 10 years ago

Windows 8.1 here, native build, don't see the same issue.

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+1400 (2014-02-05 19:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 6f3a4b6* (1 days old master)
|__/                   |  x86_64-w64-mingw32

In  [2]: ;nslookup github.com
Non-authoritative answer:

Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Name:    github.com
Address:  192.30.252.130

In  [3]: run(`ping github.com`)

Pinging github.com [192.30.252.131] with 32 bytes of data:
Reply from 192.30.252.131: bytes=32 time=57ms TTL=251
Reply from 192.30.252.131: bytes=32 time=66ms TTL=251
Reply from 192.30.252.131: bytes=32 time=51ms TTL=251
Request timed out.

Ping statistics for 192.30.252.131:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 51ms, Maximum = 66ms, Average = 58ms

In  [4]: 
ihnorton commented 10 years ago

I think I still have a win8 vm. Will try to reproduce tonight.

mlubin commented 10 years ago

I've seen a number of Win8 users who don't have this issue, so it's definitely not easily reproducible.

stevengj commented 10 years ago

Could it be some kind of firewall software? So that if the julia process is not "approved" in some way then it can't access network services?

mlubin commented 10 years ago

I wasn't able to find any firewall on this user's computer. Also it's very unusual for firewalls to prevent outbound traffic.

drlivip commented 10 years ago

I tried to give Julia permissions in the firewall to no avail. I also tried to ping google.com via the run command and received the error message about not finding the host.

mlubin commented 10 years ago

@drlivip could you confirm that DNS resolution does not work, but you can ping an explicit IP address?

flashus commented 10 years ago

@mlubin On my machine ping on IP address works, but ping on hostname doesnt.

mlubin commented 10 years ago

@flashus, could you try Wireshark (@pao's suggestion) to see what network activity is detected?

ihnorton commented 10 years ago

I wasn't able to reproduce, even with firewall on.

@flashus can you try running julia> ; cmd, and then try pinging from there?

drlivip commented 10 years ago

run(ping 192.30.252.131) worked; run(ping github.com) did not I tried the suggestion sent to @flashus above: "; cmd" Same result, ping on IP works, ping on hostname does not.

ihnorton commented 10 years ago

Ok, that's useful. There must be some limitation on the libuv process spawning, because we know it works in a "normal" cmd window.

flashus commented 10 years ago

As per @pao's suggestion I've monitored my connection with wireshark. I've tried ;ping github.com from julia, no dns request was sent. When I make same command from terminal, I saw dns request/reply packets in wireshark.

filmackay commented 10 years ago

Local firewall enabled? Tried running julia.exe as administrator?

flashus commented 10 years ago

I've added firewall rule for julia, doesnt help. Ping on ip address works from julia. Runned also as administrator. No dns request in wireshark.

ihnorton commented 10 years ago

Can someone please run ipconfig /all and post the result in a gist.

Also, try disabling IPv6. This "Server UnKnown" message seems to be a symptom of IPv4 vs v6 issues. I have no idea why this would be process-specific, but I've learned to not ask too many questions about new Windows releases.

pao commented 10 years ago

That would be sad; I've been running dual-stack for close to a year now on Windows 7 and haven't seen anything quite like this. But your final point is well taken.

drlivip commented 10 years ago

Preface: I'm an old dog computer hardware designer that does research in computational intelligence and robotics. I came to Julia, because I believe it will be a great tool for my research. However, my experience with network and internet issues is severely limited. I'm also brand new to github and not entirely familiar with the way things are done. ... That said, I disabled IPv6, and it seemed to make no difference in the syndrome we're seeing. I did an ipconfig /all before and after, but am not sure how to how to securely post the information to a gist. However, I can certainly follow directions and answer questions, and I greatly appreciate the help.

drlivip commented 10 years ago

@ihnorton: I figured out how to make a secret gist and have ipconfig dump there. What do I do to get it to you? And BTW, is there anything I can/should blot out in the listing?

ihnorton commented 10 years ago

@drlivip my email is on my github page. If you don't want to share it that's completely fine (grasping at straws anyway). Two other suggestions:

flashus commented 10 years ago

@ihorton I've tried to run in compatibility mode, checked my dns, it was already set to google servers. Nothing helps.

grayclhn commented 10 years ago

I ran into the same problem in Linux (Fedora 20), setting git to use https for github seemed to fix the problem. On the command line, run

git config --global url.https://github.com/.insteadOf git://github.com/

and try again. Not ideal, but a possible workaround.

drlivip commented 10 years ago

@graychlhn: One of the first things I did was to change to https and it did not help in my case.

I tried compatibility mode to no avail. This problem should not severely hamper my intended use of Julia; I just won't be able to easily take advantage of others' code on this particular machine.

pao commented 10 years ago

I ran into the same problem in Linux (Fedora 20), setting git to use https for github seemed to fix the problem.

That is a useful trick for getting around port blocks, and we've documented it in the README. In this particular issue DNS is failing to resolve; using .insteadOf won't fix that (unless you substituted an IP address), and it only affects use of git and GitHub, where this seems to be a more general problem.

What is very odd is that it fails even when starting a new process from within Julia.

How did you all install Julia? Using the installer or a zip file? I wonder if the zip file is blocked, so Windows is restricting its permissions.

If the zip file either (1) try the installer or (2) right click the zip file, select Properties, then hit the Unblock button near the bottom of the General tab. Delete your existing Julia and re-extract it.

drlivip commented 10 years ago

@pao: I used the 64-bit installer, the 32-bit installer, and even the v0.3.0 64-bit installer, all exhibiting the same problem. I just tried installing v0.3.0 in administrative mode in a different folder (the first folders were in C:); no difference.

pao commented 10 years ago

Darn. Thanks for testing.

kmsquire commented 10 years ago

How about posting this on 1) the StackOverflow windows-8 forum? 2) an MSDN developer forum (though I'm not sure which one)

ihnorton commented 10 years ago

I've just figured out (I believe) what is going on, although I'm not quite sure how to fix it yet.

I can replicate on Windows 7 as follows:

julia> p = `nslookup github.com`
`nslookup github.com`

julia> p.env = ByteString[""]
1-element Array{Union(ASCIIString,UTF8String),1}:
 ""

julia> run(p)
Server:  UnKnown
Address:  192.168.1.1

*** UnKnown can't find github.com: No response from server
ihnorton commented 10 years ago

It seems that something in the lpEnvironment variable is incorrect on Win8.

See similar problem here: http://stackoverflow.com/questions/2188885/createprocess-and-strange-nslookup-error

ihnorton commented 10 years ago

this works:

julia> p.env = ByteString["USERDOMAIN=io"]
1-element Array{Union(ASCIIString,UTF8String),1}:
 "USERDOMAIN=io"

julia> run(p)
Server:  xxx
Address:  192.168.1.1

Non-authoritative answer:
Name:    github.com
Address:  192.30.252.131
ihnorton commented 10 years ago

Can someone check the following on Win 8:

1) in a normal cmd, is %USERDOMAIN% set? 2) in Julia see if ENV["USERDOMAIN"] is set if not, does julia> ; hostname work? 3) try running a process with the USERDOMAIN env variable matching the output of cmd> hostname. So do as above, but with: julia> p.env = ByteString["USERDOMAIN=myhostname"]

drlivip commented 10 years ago

I followed steps 1 and 2 and ENV["USERDOMAIN"] equals %USERDOMAIN% equals APOLLO. Step 3: julia> p = nslookup github.com p = nslookup github.com nslookup github.com

julia> p.env = ByteString["USERDOMAIN=APOLLO"] p.env = ByteString["USERDOMAIN=APOLLO"] 1-element Array{Union(ASCIIString,UTF8String),1}: "USERDOMAIN=APOLLO"

julia> run(p) run(p) Server: UnKnown Address: 2001:4888:17:ff00:1e4:d::

*\ UnKnown can't find github.com: No response from server

drlivip commented 10 years ago

I don't know if this is significant, but in your failure example the address was an IPv4 local one, 192.168.... In my case the address was the IPv6 address of the DNS server. I disabled IPv6 and the address changed to the IPv4 local one, but the result was still the same error.

mrstlee commented 10 years ago

Pkg.update() worked (or more accurately didn't fail -- see below) after I exited the julia shell and started up a new one:

"julia> run(clone) fatal: destination path 'METADATA' already exists and is not an empty directory. ERROR: failed process: Process(git clone -q -b metadata-v2 https://github.com/JuliaLang/METADATA, ProcessExited(128)) [128] in pipeline_error at process.jl:476 in run at process.jl:453

julia> Pkg.update() INFO: Initializing package repository C:\Dev\julia-05c6461b55\Users\bantiro.julia INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl INFO: Updating METADATA... INFO: Computing changes... INFO: No packages to install, update or remove."

I guess the original run(clone) was working away silently updating the local copy.

wheineman commented 10 years ago

I'd like to help here. I want to use Julia at work and Windows 8.1 is the platform we're moving to. I had no problem using packages with Windows 7 but I'm seeing the problem reported here on my new Windows 8.1 laptop. Can someone summarize where we're at on this so I can figure out where to direct my efforts? For the record I have no problem using git directly to clone the METADATA directory, provided I use the https protocol instead of the git protocol.

wheineman commented 10 years ago

Here's something interesting. Running Arch Linux in VMWare Player and installing Julia in that environment. I can do Pkg.init and Pkg.update with no problems. I'm assuming git on the VMware Player is subject to the same firewall restrictions as the Windows 8 environment.

ihnorton commented 10 years ago

@wheineman I believe that there is an issue with how we are shelling out to git. See my comments starting here and the StackOverflow link. Unfortunately I missed the responses and forgot about this thread. Those responses were negative, but that lead could be pursued further (in particular by querying Windows API functions directly to see if those give a different response).

wheineman commented 10 years ago

Thanks. I'll take that as pointer and pursue. I think we can rule out the environment (firewall, etc.).

wheineman commented 10 years ago

Python does the right thing:

from subprocess import call call(["nslookup", "github.com"]) Server: ndhamrdom02.amer.pritzer.com Address: 170.116.20.22

Non-authoritative answer: Name: github.com Address: 192.30.252.130

0

I'll compare Python's call with Julia's run

drlivip commented 10 years ago

Hi! I'm glad your looking into this. I'm a hardware EE/CpE prof and had to get back to my real job, but I can run any tests or work-around's you may discover.

Dave

On Thu, Apr 24, 2014 at 4:02 PM, Willy notifications@github.com wrote:

Python does the right thing:

from subprocess import call call(["nslookup", "github.com"]) Server: ndhamrdom02.amer.pritzer.com Address: 170.116.20.22

Non-authoritative answer: Name: github.com Address: 192.30.252.130

0

I'll compare Python's call with Julia's run

— Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/julia/issues/5574#issuecomment-41325154 .

David L. Livingston, Ph.D., P.E.

Design Engineer/Consultant Livingston Embedded Computing, LLC d.livingston@ieee.org, 540-520-1848

Professor of Electrical and Computer Engineering Virginia Military Institute livingstondl@vmi.edu, 540-464-7545

"100% of the shots not taken don't go in." The Great Gretzsky, ice hockey player "Without deviation from the norm, progress is not possible." Frank Zappa, musician, composer and social satirist "Complexity breeds fragility. Fragility breeds surprises. Surprises are bad." Bob Colwell, computer engineer and Pentium architect

wheineman commented 10 years ago

Ok. Julia's run ends up calling uv_spawn in libuv, which calls the Win32 API function CreateProcessW. I suspect that the CreateProcessW parameter lpEnvironment is not being handled properly. So my next step is to call CreateProcessW mimicing how libuv calls it. As a side note Python's underlying library sets the environment variable to 0 in every case, I believe.

wheineman commented 10 years ago

Short circuit: I tried node.js's child_process.spawn() and child_process.exec(). Both performed as they should. I'm assuming they both call libuv. I'll confirm that they're calling the same libuv method(s) as julia.

drlivip commented 10 years ago

I'm about finished with classes and will be ready to do as I'm told to try and fix the bug with Win 8.1, 64 bits. I'll admit to total incompetence with git, linux, etc., but I blindly tried the following and something happened. I ran "git-bash.bat" from within the Git folder under Julia. A MingW32 command window opened and I typed the following from within the window: "git clone git://github.com/JuliaLang/METADATA.jl" This worked to clone the contents of METADATA.jl and place it in an identically named folder within Git. Running "git-cmd.bat" with git clone "git:// github.com/JuliaLang/METADATA.jl" also works. Could this process be used as some kind of workaround until the bug is tracked down?

On Mon, Apr 28, 2014 at 5:28 PM, Willy notifications@github.com wrote:

Short circuit: I tried node.js's child_process.spawn() and child_process.exec(). Both performed as they should. I'm assuming they both call libuv. I'll confirm that they're calling the same libuv method(s) as julia.

— Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/julia/issues/5574#issuecomment-41615906 .

David L. Livingston, Ph.D., P.E.

Design Engineer/Consultant Livingston Embedded Computing, LLC d.livingston@ieee.org, 540-520-1848

Professor of Electrical and Computer Engineering Virginia Military Institute livingstondl@vmi.edu, 540-464-7545

"100% of the shots not taken don't go in." The Great Gretzsky, ice hockey player "Without deviation from the norm, progress is not possible." Frank Zappa, musician, composer and social satirist "Complexity breeds fragility. Fragility breeds surprises. Surprises are bad." Bob Colwell, computer engineer and Pentium architect

kbauer commented 10 years ago

Since I have the same problem, I tried to reproduce the steps posted here. So far I too can run git clone in git-cmd and other shell environments, while it fails within julia, inhibibiting the use of Pkg. functions. I am currently using the binary installer for v0.3.0-prerelease (Windows 64bit) on Windows 8.0, 64 bit.

@drlivip Did doing the git-pull outside julia enable you to run Pkg.update() and Pkg.add(...)?

@mrstlee In which parent directory was the METADATA directory created, after which you were able to execute Pkg.update()?

drlivip commented 10 years ago

@kbauer Pkg.update() and Pkg.add() refuse to work claiming unable to access.... When I did the clone of METADATA, I had it placed in the .julia folder. Obviously the bug is still present; I was looking for a workaround. Packages can be installed using git, but the dependencies are a real hassle (maybe it's my ignorance of git).

On Tue, May 6, 2014 at 9:00 AM, kbauer notifications@github.com wrote:

Since I have the same problem, I tried to reproduce the steps posted here. So far I too can run git clone in git-cmd and other shell environments, while it fails within julia, inhibibiting the use of Pkg. functions. I am currently using the binary installer for v0.3.0-prerelease (Windows 64bit) on Windows 8.0, 64 bit.

@drlivip https://github.com/drlivip Did doing the git-pull outside julia enable you to run Pkg.update() and Pkg.add(...)?

@mrstlee https://github.com/mrstlee In which parent directory was the METADATA directory created, after which you were able to execute Pkg.update()?

— Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/julia/issues/5574#issuecomment-42298647 .

David L. Livingston, Ph.D., P.E.

Design Engineer/Consultant Livingston Embedded Computing, LLC d.livingston@ieee.org, 540-520-1848

Professor of Electrical and Computer Engineering Virginia Military Institute livingstondl@vmi.edu, 540-464-7545

"100% of the shots not taken don't go in." The Great Gretzsky, ice hockey player "Without deviation from the norm, progress is not possible." Frank Zappa, musician, composer and social satirist "Complexity breeds fragility. Fragility breeds surprises. Surprises are bad." Bob Colwell, computer engineer and Pentium architect

ivarne commented 10 years ago

Github is trigger happy when you say attempt to fix #xx it does not read context and closes the issue. Did the issue actually get fixed?