Description
As reported by an end user, if you have an npm proxy repository which is temporarily failing due to UnknownHostException this causes a 500 response to be returned from Nexus.
This is true even if the repository is in automatic or manual block mode. The DNS lookup is still attempted. If the proxy having the problem is in an npm group repository this problem causes all queries to the group to fail with 500 error.
Nexus should not be attempting any network access to the remote if it is in blocked mode.
I've attached a work directory which can be used to simulate this problem. It has an npm group repository which contains a proxy to the npmjs registry. I first made a request for "/-/all" to the npm proxy to populate the metadata, then changed the remote to http://registrie.npmjs.org to cause a DNS lookup failure. If you load this configuration you'll see the DNS lookup is done even when the repository is in blocked mode.
Caused by: java.net.UnknownHostException: registrie.npmjs.org: unknown error
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_40]
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:907) ~[na:1.8.0_40]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1302) ~[na:1.8.0_40]
at java.net.InetAddress.getAllByName0(InetAddress.java:1255) ~[na:1.8.0_40]
at java.net.InetAddress.getAllByName(InetAddress.java:1171) ~[na:1.8.0_40]
at java.net.InetAddress.getAllByName(InetAddress.java:1105) ~[na:1.8.0_40]
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:102) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) ~[httpclient-4.3.6.jar:4.3.6]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) ~[httpclient-4.3.6.jar:4.3.6]
at com.bolyuba.nexus.plugin.npm.service.internal.proxy.HttpProxyMetadataTransport.fetchPackageRoot(HttpProxyMetadataTransport.java:137) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.ProxyMetadataServiceImpl.mayUpdatePackageRoot(ProxyMetadataServiceImpl.java:203) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.ProxyMetadataServiceImpl.doGeneratePackageRoot(ProxyMetadataServiceImpl.java:189) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.GeneratorSupport.generatePackageRoot(GeneratorSupport.java:108) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.GroupMetadataServiceImpl.doGeneratePackageRoot(GroupMetadataServiceImpl.java:68) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.GeneratorSupport.generatePackageRoot(GeneratorSupport.java:108) ~[na:na]
at com.bolyuba.nexus.plugin.npm.service.internal.GeneratorSupport.producePackageRoot(GeneratorSupport.java:77) ~[na:na]
at com.bolyuba.nexus.plugin.npm.group.DefaultNpmGroupRepository.doRetrieveLocalItem(DefaultNpmGroupRepository.java:134) ~[na:na]
... 98 common frames omitted
Attachments
Issue Links
- fixed by
-
NEXUS-8062 impossible to delete stale hosted npm repository metadata
-
- Closed
-
- testing discovered
-
NEXUS-8334 Error 500 when attempting to hit badly configured npm proxy
-
- Closed
-