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

Problem installing plugins without checksums #13196

Closed
lmenezes opened this issue Aug 29, 2015 · 6 comments
Closed

Problem installing plugins without checksums #13196

lmenezes opened this issue Aug 29, 2015 · 6 comments
Labels

Comments

@lmenezes
Copy link
Contributor

trying to make kopf work with 2.0-beta1 but I just got:

[11:01] leonardo.menezes:elasticsearch-2.0.0-beta1/ $ ./bin/plugin install lmenezes/elasticsearch-kopf/develop
-> Installing lmenezes/elasticsearch-kopf/develop...
Trying http://download.elastic.co/lmenezes/elasticsearch-kopf/elasticsearch-kopf-develop.zip ...
Trying http://search.maven.org/remotecontent?filepath=lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip ...
Downloading .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip checksums if available ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip ...
Downloading ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip checksums if available ...

is this the expected behaviour? I will add checksums if necessary, but going from specified branch to master branch in case no checksum is found doesn't seem like the expected outcome(but maybe it is...)

@dadoonet
Copy link
Member

I think you're right. It's a bug IMO.

In the meantime, could you add to your repo a checksum file? May be not doable with github though...

@lmenezes
Copy link
Contributor Author

yeah, will try that in the afternoon, need to leave now. thanks :)

@dadoonet
Copy link
Member

You can actually run:

bin/plugin https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip

So you don't have to provide the checksum file for now.

@dadoonet
Copy link
Member

I see what is happening. We expect to get a FileNotFoundException when we download a checksum file if this one does not exist but we get a IOException:

Can't get https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip.sha1 to /var/folders/r_/r14sy86n2zb91jyz1ptb5b4w0000gn/T/elasticsearch-kopf765881667629279646.zip.sha1

https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/common/http/client/HttpDownloadHelper.java#L156-156

Will propose a fix.

@dadoonet
Copy link
Member

Weird...

We have a stacktrace:

java.io.IOException: Can't get https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip.sha1 to /var/folders/r_/r14sy86n2zb91jyz1ptb5b4w0000gn/T/elasticsearch-kopf2636540761510642632.zip.sha1
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.downloadFile(HttpDownloadHelper.java:429)
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.get(HttpDownloadHelper.java:306)
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.run(HttpDownloadHelper.java:292)
Caused by: java.io.FileNotFoundException: https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip.sha1
    at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.downloadFile(HttpDownloadHelper.java:422)
    ... 2 more
Caused by: java.io.FileNotFoundException: https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip.sha1
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.openConnection(HttpDownloadHelper.java:376)
    at org.elasticsearch.common.http.client.HttpDownloadHelper$GetThread.get(HttpDownloadHelper.java:300)
    ... 1 more

This code is supposed to unwrap the FileNotFoundException but it does not:

if (ExceptionsHelper.unwrapCause(e) instanceof FileNotFoundException) {
     // checksum file didn't exist
     return false;
}

unwrapCause() does not work in our case because we don't have any ElasticsearchWrapperException here:

public static Throwable unwrapCause(Throwable t) {
    Throwable result = t;
    while (result instanceof ElasticsearchWrapperException) {
       // Skipped for clarity
    }
    return result;
}

I guess this happened when we removed most of the elasticsearch exception and replaced them with standard java exceptions. @s1monw WDYT?

@clintongormley
Copy link

thanks for reporting this @lmenezes

dadoonet added a commit to dadoonet/elasticsearch that referenced this issue Aug 29, 2015
```sh
bin/plugin install lmenezes/elasticsearch-kopf/develop
-> Installing lmenezes/elasticsearch-kopf/develop...
Trying http://download.elastic.co/lmenezes/elasticsearch-kopf/elasticsearch-kopf-develop.zip ...
Trying http://search.maven.org/remotecontent?filepath=lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip ...
Downloading .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip checksums if available ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip ...
Downloading ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip checksums if available ...
```

This happens because we don't have anymore ElasticsearchWrapperException here but standard java exceptions.

Closes elastic#13196.
dadoonet added a commit that referenced this issue Aug 29, 2015
```sh
bin/plugin install lmenezes/elasticsearch-kopf/develop
-> Installing lmenezes/elasticsearch-kopf/develop...
Trying http://download.elastic.co/lmenezes/elasticsearch-kopf/elasticsearch-kopf-develop.zip ...
Trying http://search.maven.org/remotecontent?filepath=lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/lmenezes/elasticsearch-kopf/develop/elasticsearch-kopf-develop.zip ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip ...
Downloading .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/develop.zip checksums if available ...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip ...
Downloading ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip checksums if available ...
```

This happens because we don't have anymore ElasticsearchWrapperException here but standard java exceptions.

Closes #13196.

(cherry picked from commit 03bb285)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants