Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Operation timed out while downloading #16

Open
tarinidash opened this issue Feb 9, 2017 · 10 comments
Open

Operation timed out while downloading #16

tarinidash opened this issue Feb 9, 2017 · 10 comments

Comments

@tarinidash
Copy link

my configuration:

pom.xml ->

pl.allegro.tech
embedded-elasticsearch
2.1.0
testCompile

TestClass ->
private EmbeddedElastic embeddedElastic;

@Before
public void setUp() throws Exception {

    embeddedElastic = EmbeddedElastic.builder()
            .withElasticVersion("5.1.1")
            .withSetting(PopularProperties.TRANSPORT_TCP_PORT, 9930)
            .withSetting(PopularProperties.CLUSTER_NAME, "local")
            .withEsJavaOpts("-Xms128m -Xmx512m")
            .withStartTimeout(2, TimeUnit.MINUTES)
            .build()
            .start();
}

Error:

2017-02-08 20:19:27,482 thread=[main] logType=INFO p.a.t.embeddedelasticsearch.ElasticSearchInstaller - Downloading : https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/elasticsearch-5.1.1.zip...

java.net.ConnectException: Operation timed out

at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)

Not sure what I am missing here. Any pointer?

@gaczm
Copy link
Contributor

gaczm commented Feb 9, 2017

Hi, is that issue persistent, or just happened one time? It looks like your machine was unable to connect with elastic servers. If this is persistent issue check if you are able to download elasticsearch archive with wget/browser (using same url as embedded-elasticsearch: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip)

@tarinidash
Copy link
Author

tarinidash commented Feb 9, 2017

its been persistent. If I click on the url inside IDE it takes me to browser and elasticsearch-5.1.1.zip file is downloaded. Its just file not being downloaded from IDE(Intellij).

Looks like file downloading is not a problem, however it does not get downloaded inside IDE.

Note: IDE downloads the file to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/

Is there anyway I can change the target download dir(something like /tmp)? It may be permission issue.

@tarinidash
Copy link
Author

I manually downloaded elasticsearch-5.1.1.zip to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/ and it strated working fine.

Not sure where the issue is. It would be nice if there is an option for target download dir for EmbeddedElastic

@gaczm
Copy link
Contributor

gaczm commented Feb 9, 2017

Could you paste here full stacktrace?

@tarinidash
Copy link
Author

2017-02-09 14:31:04,039 thread=[main] logType=INFO p.a.t.embeddedelasticsearch.ElasticSearchInstaller - Downloading : https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/elasticsearch-5.1.1.zip...

java.net.ConnectException: Operation timed out

at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1045)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1478)
at pl.allegro.tech.embeddedelasticsearch.ElasticSearchInstaller.download(ElasticSearchInstaller.java:113)
at pl.allegro.tech.embeddedelasticsearch.ElasticSearchInstaller.installElastic(ElasticSearchInstaller.java:59)
at pl.allegro.tech.embeddedelasticsearch.ElasticSearchInstaller.install(ElasticSearchInstaller.java:48)
at pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic.installElastic(EmbeddedElastic.java:56)
at pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic.start(EmbeddedElastic.java:47)
at com.demo.backendDao.ElasticSearchDaoTest.setUp(ElasticSearchDaoTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Process finished with exit code 255

@gaczm
Copy link
Contributor

gaczm commented Feb 10, 2017

From stacktrace, this is not permissions issue, but networking. Please try adding explicit download url without https:

    embeddedElastic = EmbeddedElastic.builder()
            .withDownloadUrl(URI.create("http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip").toURL())
            .withElasticVersion("5.1.1")
            .withSetting(PopularProperties.TRANSPORT_TCP_PORT, 9930)
            .withSetting(PopularProperties.CLUSTER_NAME, "local")
            .withEsJavaOpts("-Xms128m -Xmx512m")
            .withStartTimeout(2, TimeUnit.MINUTES)
            .build()
            .start()

@tarinidash
Copy link
Author

tarinidash commented Feb 10, 2017

Even with below option the downloaded url converted to https. Is there an option to mention proxy? We are behind proxy.

@before
public void setUp() throws Exception {

    embeddedElastic = EmbeddedElastic.builder()
            .withDownloadUrl(URI.create("http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip").toURL())
            .withElasticVersion("5.1.1")
            .withSetting(PopularProperties.TRANSPORT_TCP_PORT, 9930)
            .withSetting(PopularProperties.CLUSTER_NAME, "local")
            .withEsJavaOpts("-Xms128m -Xmx512m")
            .withStartTimeout(2, TimeUnit.MINUTES)
            .build()
            .start();

}

StackTrace >>

2017-02-10 08:25:26,974 thread=[main] logType=INFO p.a.t.embeddedelasticsearch.ElasticSearchInstaller - Downloading : https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/elasticsearch-5.1.1.zip...

java.net.ConnectException: Operation timed out (Connection timed out)

at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1045)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1478)

@gaczm
Copy link
Contributor

gaczm commented Feb 27, 2017

Sorry for lack of response. Do you solved a problem? As to my advice to put download url explicitly, when you specify both version and download url, then download url will be ignored. So skip invocation of .withElasticVersion("5.1.1"). As to proxy: do you have that proxy configured in your browser? (you said that you are able to downlad elastic by browser). If so, what happens when you try to download it by wget for instance?

@tarinidash
Copy link
Author

tarinidash commented Mar 7, 2017

Its fails with even if I remove '.withElasticVersion("5.1.1")'.
My configuration looks as below.

embeddedElastic = EmbeddedElastic.builder()
.withDownloadUrl(URI.create("http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip").toURL())
.withSetting(PopularProperties.TRANSPORT_TCP_PORT, 9930)
.withSetting(PopularProperties.CLUSTER_NAME, "local")
.withEsJavaOpts("-Xms128m -Xmx512m")
.withStartTimeout(2, TimeUnit.MINUTES)
.build()
.start();

StackTrace >>

2017-03-07 13:31:16,902 thread=[main] logType=INFO p.a.t.embeddedelasticsearch.ElasticSearchInstaller - Downloading : http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip to /var/folders/4c/sqrnrxg109x79j2lv9bmnrl801g3xn/T/embedded-elasticsearch-temp-dir/elasticsearch-5.1.1.zip...

java.net.ConnectException: Operation timed out (Connection timed out)

at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)

I am able to download the file through wget and by clicking the download link in stack trace. I am little inclined towards proxy being causing the issue.

Wget

wget http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
--2017-03-07 13:32:39-- http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
Resolving proxyhost... ipaddress
Connecting to proxyhost|ipaddress|:port... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip [following]
--2017-03-07 13:32:39-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
Connecting to proxyhost|ipaddress|:port... connected.
Proxy request sent, awaiting response... 200 OK
Length: 33307881 (32M) [application/zip]
Saving to: ‘elasticsearch-5.1.1.zip’

elasticsearch-5.1.1.zip 100%[==========================================================================================================================================>] 31.76M 3.82MB/s in 9.1s

2017-03-07 13:32:49 (3.47 MB/s) - ‘elasticsearch-5.1.1.zip’ saved [33307881/33307881]

@anz2050
Copy link

anz2050 commented Dec 6, 2017

Anyone, got resolved this? I am also facing same in my integration tests:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flummi' defined in org.uptake.spring.PersistenceRawElasticsearchConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.otto.flummi.Flummi]: Factory method 'flummi' threw exception; nested exception is pl.allegro.tech.embeddedelasticsearch.EmbeddedElasticsearchStartupException: Failed to start elasticsearch within time-out at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]

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

No branches or pull requests

3 participants