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

Failure recovering connection on Windows #72

Open
3noch opened this issue Aug 19, 2014 · 14 comments
Open

Failure recovering connection on Windows #72

3noch opened this issue Aug 19, 2014 · 14 comments

Comments

@3noch
Copy link

3noch commented Aug 19, 2014

Moved from haskell/cabal#2035.

Most pertinent: compiling and running this program with GHC 7.8.3 produces the following on my Windows 8.1 x64 machine. I have tried to reproduce on VMs but can't.

http-test> ghc --make Main.hs -o test.exe -prof -auto-all -caf-all
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking test.exe ...

http-test> .\test.exe +RTS -xc
Trying to download http://hackage.haskell.org/packages/archive/00-index.tar.gz
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.18.0.5


Creating new connection to hackage.haskell.org
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
Received:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.6.0
Date: Mon, 18 Aug 2014 22:29:21 GMT
Content-Type: text/plain; charset=UTF-8
Connection: keep-alive
Location: /packages/index.tar.gz
Content-Length: 0


301 - redirect
Redirecting to http://hackage.haskell.org/packages/index.tar.gz ...
Sending:
GET /packages/index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.18.0.5


Recovering connection to hackage.haskell.org
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
  Main.main,
  called from :Main.CAF:main
test.exe: <socket: 336>: hGetBufSome: failed (Unknown error)
@hsenag
Copy link
Member

hsenag commented Aug 26, 2014

Could you check if this is a regression between 4000.2.16 and 4000.2.17? It turns out #68 is a regression caused by 5c1c7ba, though we don't yet know the details. As this problem is in vaguely the same area it seems worth checking.

@3noch
Copy link
Author

3noch commented Aug 26, 2014

@hsenag Sure, I'll check.

@3noch
Copy link
Author

3noch commented Sep 1, 2014

@hsenag Still no luck.

http-test> dist\build\http-test\http-test.exe
Trying to download http://hackage.haskell.org/packages/archive/00-index.tar.gz
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.18.0.5


Creating new connection to hackage.haskell.org
Received:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.6.0
Date: Mon, 01 Sep 2014 16:00:40 GMT
Content-Type: text/plain; charset=UTF-8
Connection: keep-alive
Location: /packages/index.tar.gz
Content-Length: 0


301 - redirect
Redirecting to http://hackage.haskell.org/packages/index.tar.gz ...
Sending:
GET /packages/index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.18.0.5


Recovering connection to hackage.haskell.org
http-test.exe: <socket: 336>: hGetBufSome: failed (Unknown error)

Here's what was linked (notice some interesting warnings):

http-test> cabal repl
Preprocessing executable 'http-test' for http-test-0.1.0.0...
GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package Win32-2.3.0.2 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package text-1.1.0.0 ... linking ... done.
Loading package hashable-1.2.2.0 ... linking ... done.
Loading package case-insensitive-1.1.0.3 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package parsec-3.1.5 ... linking ... done.
Loading package network-2.4.2.3 ... linking ... ghc.exe: warning: inet_ntoa from ws2_32 is linked instead of __imp_inet_ntoa
ghc.exe: warning: getnameinfo from ws2_32 is linked instead of __imp_getnameinfo
ghc.exe: warning: getaddrinfo from ws2_32 is linked instead of __imp_getaddrinfo
ghc.exe: warning: freeaddrinfo from ws2_32 is linked instead of __imp_freeaddrinfo
ghc.exe: warning: accept from ws2_32 is linked instead of __imp_accept
ghc.exe: warning: WSACleanup from ws2_32 is linked instead of __imp_WSACleanup
ghc.exe: warning: WSAStartup from ws2_32 is linked instead of __imp_WSAStartup
ghc.exe: warning: WSACleanup from ws2_32 is linked instead of __imp_WSACleanup
done.
Loading package old-time-1.1.0.2 ... linking ... done.
Loading package HTTP-4000.2.16 ... linking ... done.
Ok, modules loaded: Main.

@3noch
Copy link
Author

3noch commented Oct 1, 2014

Anyway I can help further to track this bug down?

@hsenag
Copy link
Member

hsenag commented Oct 3, 2014

It's going to be hard unless we can isolate what is triggering it on your system.

I've recently got a new Windows 8.1 machine and I've tried your test program myself with GHC 7.8.3, both 32 bit and 64 bit versions, and it works fine. I don't get any of the ws2_32 warnings above.

Note that I do have msys2 installed, but I've also tried compiling and running directly from a command prompt.

Some random thoughts:

  • Are gcc and ld coming from the right place (i.e. mingw/bin in the GHC install)?
  • Does GHC 7.6.3 work?
  • Are you using 32-bit or 64-bit GHC and have you tried the other one?
  • Is the problem with the build binary or your machine, i.e. if you move a binary from your machine to a working one does the binary work, and vice-versa?

I also googled for your warning and found
https://ghc.haskell.org/trac/ghc/ticket/8918 and haskell/network#132

I'm not sure if they are relevant but it may be worth trying a recent version of the network package from github.

@3noch
Copy link
Author

3noch commented Oct 4, 2014

Terrible news: I can no longer reproduce this! My only guess as to why it disappeared is some combination of the following:

  • Installing Cygwin (although removing it has not reintroduced the issue)
  • Windows update of some sort
  • Update to Covenant Eyes (Internet monitoring/filtering software)

My money is on the last one.

@hsenag
Copy link
Member

hsenag commented Oct 5, 2014

Well, at least your problem is fixed :-) Hopefully the record will be useful if anyone else has a random problem like this in future.

@hsenag hsenag closed this as completed Oct 5, 2014
@sapek
Copy link

sapek commented Dec 8, 2014

I can reproduce the problem on my Windows Server 2012, both with cabal update and the test program. I built the test program against http 4000.2.10 (the version in Haskell Platform 2014.2.0.0).

The problem is intermittent, it doesn't fail every time. Sometimes the test program will succeed several times in a row and sometimes it will fail several times in a row.

@hsenag
Copy link
Member

hsenag commented Dec 8, 2014

Do you have any of the warnings the original reporter had from 'cabal repl'?

ghc.exe: warning: getnameinfo from ws2_32 is linked instead of __imp_getnameinfo

@hsenag hsenag reopened this Dec 8, 2014
@sapek
Copy link

sapek commented Dec 8, 2014

Yes, I do see the same warnings.

@sapek
Copy link

sapek commented Jan 8, 2015

I think I know what the problem is. I'm getting the problem when running cabal behind a proxy. It seems like on my network the firewall allows outgoing connections w/o proxy but then kills them. On my network cabal also fails on Linux. The workaround that works both for Linux and Windows is to specify proxy via the environment variables HTTP_PROXY and HTTPS_PROXY.

I'm guessing that the HTTP library can no longer detect system proxy configuration on Windows 8.x. It appears to detect it on older versions of Windows.

@3noch
Copy link
Author

3noch commented Jan 8, 2015

Could the linking warnings be related to the inability to detect the system proxy configuration? (Good find, by the way.)

@sapek
Copy link

sapek commented Jan 8, 2015

The build warning? I doubt that, proxy detection should be a runtime operation.

@3noch
Copy link
Author

3noch commented Jan 8, 2015

Right, but I'm thinking that potentially linking the wrong functions at compile time could cause runtime failure.

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

No branches or pull requests

3 participants