Jonathan Gallagher
Jonathan Gallagher

Reputation: 2245

Haskell stack connection timeout

I have installed stack on WSL Ubuntu using WSL2 on Windows 10. The installation completed successfully, but when I test stack with

stack path --local-bin

I get the following error message:

Writing implicit global project config file to: 
/home/jdgallag/.stack  /global-project/stack.yaml 
Note: You can change snapshot via the resolver field there.      
HttpExceptionRequest Request {                                                                                            
host                 = "s3.amazonaws.com"                                                                               
port                 = 443                                                                                              
secure               = True                                                                                             
requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
path                 = "/haddock.stackage.org/snapshots.json"                                                           
queryString          = ""                                                                                               
method               = "GET"                                                                                            
proxy                = Nothing                                                                                          
rawBody              = False                                                                                            
redirectCount        = 10                                                                                               
responseTimeout      = ResponseTimeoutDefault       
requestVersion       = HTTP/1.1                                                                                       
}                                                                                                                        
ConnectionTimeout   

I have seen some other posts about issues like this one, but none that are resolved, and they are older. Also, I am not on a proxy, this is my personal computer, and I turned the firewall completely off. That said, when I attempt this over a vpn connection I get a different error. Could it be an ssl/https issue since WSL2 is technically a different IP address from Windows, and so the connection is being blocked on the amazon side?

For the record when attempting the command on a VPN, the error I get is

Writing implicit global project config file to: 
/home/jdgallag/.stack/global-project/stack.yaml                         
Note: You can change the snapshot via the resolver field there.                                                         
HttpExceptionRequest Request {                                                                                            
host                 = "s3.amazonaws.com"                                                                               
port                 = 443                                                                                              
secure               = True                  
requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]                               
path                 = "/haddock.stackage.org/snapshots.json"                                                           
queryString          = ""                                                                                               
method               = "GET"                                                                                            
proxy                = Nothing                                                                                          
rawBody              = False                                                                                            
redirectCount        = 10                                                                                               
responseTimeout      = ResponseTimeoutDefault                                                                           
requestVersion       = HTTP/1.1                                                                                       
}                                                                                                                        
(InternalException (HandshakeFailed Error_EOF)) 

Update

Reverting to WSL-1 "solves" the problem, so the issue is something specific to WSL-2. I replicated the problem with a fresh install of Windows on a separate machine, but haven't found a way around the issue yet.

Upvotes: 4

Views: 1159

Answers (2)

Abhijit Sarkar
Abhijit Sarkar

Reputation: 24593

I can confirm that this problem no longer exists using stack 3.1.1. So, upgrade stack, and you'll be good to go.

Upvotes: 0

Anton Kucher
Anton Kucher

Reputation: 41

I have wls2 ubuntu 20.02 installed on my pc
fixed this problem with changing the contents of /etc/resolv.conf

cd /etc
sudo *your favorite editor* resolv.conf

added Google DNS servers as

nameserver 8.8.8.8
nameserver 8.8.4.4

this fixed stack not working for me.

Upvotes: 4

Related Questions