Repository navigation
Closed
Labels
🚨 criticalP0 critical issue. Requires immediate fixP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
We've started seeing an authentication error in our project after we upgraded to 0.23.1, the issue also seems to be present in 0.24.0. Reverting to 0.22.0 solves the issue.
We start seeing the following 404 error when running a spark application that uses NIO to access gcs files:
code: 0
message: Error code 404 trying to get security access token from Compute Engine metadata for the default service account. This may be because the virtual machine instance does not have permission scopes specified.
reason: null
location: null
retryable: false
com.google.cloud.storage.StorageException: Error code 404 trying to get security access token from Compute Engine metadata for the default service account. This may be because the virtual machine instance does not have permission scopes specified.
at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:189)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.get(HttpStorageRpc.java:339)
at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:197)
at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:194)
at shaded.cloud_nio.com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:91)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:54)
at com.google.cloud.storage.StorageImpl.get(StorageImpl.java:194)
at com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider.checkAccess(CloudStorageFileSystemProvider.java:614)
at java.nio.file.Files.exists(Files.java:2385)
at htsjdk.samtools.util.IOUtil.assertFileIsReadable(IOUtil.java:346)
at org.broadinstitute.hellbender.engine.ReadsDataSource.<init>(ReadsDataSource.java:206)
at org.broadinstitute.hellbender.engine.ReadsDataSource.<init>(ReadsDataSource.java:162)
at org.broadinstitute.hellbender.engine.ReadsDataSource.<init>(ReadsDataSource.java:118)
at org.broadinstitute.hellbender.engine.ReadsDataSource.<init>(ReadsDataSource.java:87)
at org.broadinstitute.hellbender.engine.spark.datasources.ReadsSparkSource.getHeader(ReadsSparkSource.java:182)
at org.broadinstitute.hellbender.engine.spark.GATKSparkTool.initializeReads(GATKSparkTool.java:390)
at org.broadinstitute.hellbender.engine.spark.GATKSparkTool.initializeToolInputs(GATKSparkTool.java:370)
at org.broadinstitute.hellbender.engine.spark.GATKSparkTool.runPipeline(GATKSparkTool.java:360)
at org.broadinstitute.hellbender.engine.spark.SparkCommandLineProgram.doWork(SparkCommandLineProgram.java:38)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.runTool(CommandLineProgram.java:119)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMainPostParseArgs(CommandLineProgram.java:176)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:195)
at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:131)
at org.broadinstitute.hellbender.Main.mainEntry(Main.java:152)
at org.broadinstitute.hellbender.Main.main(Main.java:233)
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.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:736)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.io.IOException: Error code 404 trying to get security access token from Compute Engine metadata for the default service account. This may be because the virtual machine instance does not have permission scopes specified.
at shaded.cloud_nio.com.google.auth.oauth2.ComputeEngineCredentials.refreshAccessToken(ComputeEngineCredentials.java:137)
at shaded.cloud_nio.com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:160)
at shaded.cloud_nio.com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:146)
at shaded.cloud_nio.com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:96)
at com.google.cloud.http.HttpTransportOptions$1.initialize(HttpTransportOptions.java:157)
at shaded.cloud_nio.com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)
at shaded.cloud_nio.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:300)
at shaded.cloud_nio.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at shaded.cloud_nio.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at shaded.cloud_nio.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.get(HttpStorageRpc.java:337)
... 32 more
ERROR: (gcloud.dataproc.jobs.submit.spark) Job [cb87810a-0133-42b3-a954-363b62adce39] entered state [ERROR] while waiting for [DONE].
Looking at the dependency updates in this project, it seems like one of the auth libraries updated to version 0.8.0. Could that be the causing the issue?
Is there some new configuration setting we should be using in our gcloud project? Any help would be appreciated.
Metadata
Metadata
Assignees
Labels
🚨 criticalP0 critical issue. Requires immediate fixP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
neozwu commentedon Sep 21, 2017
@lbergelson from a quick scan of google-auth-client-java, it seems there's some code change regarding compute engine credential in version 0.7.1. Can you help check whether you could repro this issue with auth 0.7.1 ? (I saw you use gradle, so I assume simply declaring auth 0.7.1 as an explicit compile dependency should override auth 0.7.0)
lbergelson commentedon Sep 21, 2017
@neozwu I tried running with 0.22.0 but forcing the version of auth to 0.7.1, and was unable to reproduce the error that way. I also tried forcing 0.8.0 and wasn't able to reproduce the problem that way either. So either I'm building it wrong or it's not the auth library. From running
gradle dependenciesit looks like the force is working though.droazen commentedon Sep 21, 2017
@neozwu I was able to resolve the 404 error that @lbergelson reported by building a custom version of the latest master of
google-cloud-javawith the following patch applied:So, it's very likely that the culprit is the
google-auth-library-javachange in 0.7.1 that @neozwu pointed out (https://github.com/google/google-auth-library-java/releases/tag/v0.7.1)It looks like they moved from using a domain name for the
METADATA_SERVER_URLto a hardcoded IP address (see https://github.com/google/google-auth-library-java/pull/110/files) -- I wonder if that is causing this somehow.lbergelson commentedon Sep 21, 2017
So it seems like the reason that I wasn't able to reproduce the issue by forcing 0.7.1 was that we're using the shaded jar, so the force statement wasn't actually replacing the dependencies.
droazen commentedon Sep 25, 2017
Any suggestions on how we could go about dealing with this issue? Does anyone think that the hardcoded IP address added in https://github.com/google/google-auth-library-java/pull/110/files could be the cause?
lbergelson commentedon Sep 29, 2017
Does anyone have any input on this one? It's important to us that we be able to upgrade.
neozwu commentedon Sep 29, 2017
@lukecwik Could you comment on whether there could be any potential issues with hardcoded IP address for metadata server ? I saw you suggested an explicit IP vs domain name here.
lukecwik commentedon Oct 2, 2017
GCE metadata server team specifically recommend using the IP address as a best practice to avoid DNS issues when contacting the metadata server.
Note that all of the Apiary client libraries have been using the fixed IP address for quite some time and to my knowledge have not experienced this issue.
The downside is that if the GCE metadata server team were to ever change the IP address of the metadata server, it would break everyone who hardcoded the address.
lbergelson commentedon Oct 12, 2017
@neozwu @lukecwik Does anyone have any suggestions about how we can proceed? Is there some information we can provide that would be helpful for debugging this?
lukecwik commentedon Oct 12, 2017
Since you have a complicated setup, it would be best if you tried executing a simple program which only invokes the google-auth-library-java 0.7.1 from within the environment without adding additional dependencies which would exclude your network/host setup from the failure scenario or shell out and use curl to contact the metadata server from your application and log what you get back using the IP address directly. If a much simpler application/shelling out works means that you have a dependency/configuration of java issue going on.
If you exclude the host/network setup from the failure condition, then comparing the detailed maven dependency tree of the working and broken versions could help. For every library that changed, try doing a strict override on each changed dependency (and only that changed dependency keeping all other transitive dependencies the same) to narrow it down to which one is causing the failure.
jean-philippe-martin commentedon Oct 16, 2017
I was able to reproduce the same exact error running gatk PrintReadsSpark on a fresh Dataproc cluster with no special configuration applied. This suggests cluster/firewall misconfiguration may not be the problem.
My repro's very short:
droazen commentedon Oct 17, 2017
That's great @jean-philippe-martin -- now we're getting somewhere! Can you test whether the error goes away if you build a custom
google-cloud-javashaded jar withgoogle.auth.versiondowngraded to0.7.0, as described in #2453 (comment)?lukecwik commentedon Oct 17, 2017
Your repro package still seems like it brings in a bunch of dependencies via Spark/CloudStorageFilesystem.
From your simple application, try shelling out and sending a curl request by using the raw IP address and the non IP address version:
67 remaining items
jean-philippe-martin commentedon Aug 17, 2018
@droazen what wonderful news! That's great!
jean-philippe-martin commentedon Aug 21, 2018
I was able to identify the root cause, it's https://issues.apache.org/jira/browse/MSHADE-156
droazen commentedon Aug 24, 2018
I've confirmed that this issue is resolved with the latest release (0.59.0), so this can finally be closed! Thanks to everyone for their assistance over the past year!
google-cloud-java: update to the official 0.59.0 release, and move of…
lbergelson commentedon Sep 11, 2018
This long nightmare is over, but I forgot to close the issue. Closing it. Thank you everyone.
deps: update dependency com.google.cloud:google-cloud-bigquery to v2.…
chore(main): release 3.5.0 (#2457)
build(deps): update dependency org.codehaus.mojo:build-helper-maven-p…
build(deps): update dependency org.codehaus.mojo:build-helper-maven-p…
chore(main): release 2.51.0 (googleapis#2453)