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

Retry "file status" request with exponential backoff if it failed #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

esevastyanov
Copy link

No description provided.

@esevastyanov esevastyanov changed the title Retry "file status" request if it failed with exponential backoff Retry "file status" request with exponential backoff if it failed Apr 6, 2021
fs.getFileStatus(p).getLen
// You can send 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests per second per prefix in an S3 bucket
// This block catches "503 Slow Down" error, retries a request and sleeps for up to 6 (=2+4) seconds in total
retryWithExponentialBackoff(3) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's cool.
I wonder if you have any idea how to retry SparkContext.textFile the same way?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's try these props, not sure if they are supported

spark.hadoop.fs.s3.maxRetries=3
spark.hadoop.fs.s3.consistent.retryPolicyType=exponential

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, we could still be hit during write operations:

2021-04-06T13:23:04,926 WARN [task-result-getter-0] org.apache.spark.scheduler.TaskSetManager - Lost task 210.1 in stage 3.0 (TID 12452, 172.19.15.254, executor 122): java.lang.RuntimeException: org.apache.hadoop.fs.s3.S3Exception: org.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 503, ResponseStatus: Slow Down, XML Error Message: SlowDownPlease reduce your request rate.5HRTEN7YXGVNM9EF+LUSwUnkV+XIW3aJPuhz24RwuwZlhCD/8oYfHMoWq0i2qnnTyugAHr7bGb46ahZazUi0E/6z2BY= at com.metamx.starfire.batch.shaded.com.google.common.base.Throwables.propagate(Throwables.java:240) at com.metamx.hadoop.Utils.retry(Utils.java:30) at com.metamx.hadoop.MultipleOutputFormat.getBaseRecordWriter(MultipleOutputFormat.java:103) at com.metamx.hadoop.MultipleOutputFormat$2.getStore(MultipleOutputFormat.java:239) at com.metamx.hadoop.MultipleOutputFormat$2.write(MultipleOutputFormat.java:205) at com.metamx.hadoop.PipesOutputFormat$2.write(PipesOutputFormat.java:192) at com.metamx.hadoop.PipesOutputFormat$2.write(PipesOutputFormat.java:185) at com.metamx.starfire.spark.sink.MMXDeprecatedOutputFormatWrapper$RecordWriterWrapper.write(MMXDeprecatedOutputFormatWrapper.java:108) at org.apache.spark.SparkHadoopWriter.write(SparkHadoopWriter.scala:95) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply$mcV$sp(PairRDDFunctions.scala:1212) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1210) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1210) at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1341) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1218) at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1197) at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87) at org.apache.spark.scheduler.Task.run(Task.scala:99) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:282) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.hadoop.fs.s3.S3Exception: org.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 503, ResponseStatus: Slow Down, XML Error Message: SlowDownPlease reduce your request rate.5HRTEN7YXGVNM9EF+LUSwUnkV+XIW3aJPuhz24RwuwZlhCD/8oYfHMoWq0i2qnnTyugAHr7bGb46ahZazUi0E/6z2BY= at org.apache.hadoop.fs.s3native.Jets3tNativeFileSystemStore.propagateRootCause(Jets3tNativeFileSystemStore.java:386) at org.apache.hadoop.fs.s3native.Jets3tNativeFileSystemStore.storeEmptyFile(Jets3tNativeFileSystemStore.java:160) at sun.reflect.GeneratedMethodAccessor268.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:190) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:103) at org.apache.hadoop.fs.s3native.$Proxy7.storeEmptyFile(Unknown Source) at org.apache.hadoop.fs.s3native.NativeS3FileSystem.createParent(NativeS3FileSystem.java:575) at org.apache.hadoop.fs.s3native.NativeS3FileSystem.delete(NativeS3FileSystem.java:396) at com.metamx.hadoop.MultipleOutputFormat.deleteExistingFiles(MultipleOutputFormat.java:178) at com.metamx.hadoop.MultipleOutputFormat.access$000(MultipleOutputFormat.java:30) at com.metamx.hadoop.MultipleOutputFormat$1.call(MultipleOutputFormat.java:109) at com.metamx.hadoop.Utils.retry(Utils.java:24) ... 19 more Caused by: org.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 503, ResponseStatus: Slow Down, XML Error Message: SlowDownPlease reduce your request rate.5HRTEN7YXGVNM9EF+LUSwUnkV+XIW3aJPuhz24RwuwZlhCD/8oYfHMoWq0i2qnnTyugAHr7bGb46ahZazUi0E/6z2BY= at org.jets3t.service.S3Service.putObject(S3Service.java:2358) at org.apache.hadoop.fs.s3native.Jets3tNativeFileSystemStore.storeEmptyFile(Jets3tNativeFileSystemStore.java:158) ... 31 more-

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't know where it goes from but seems like this stack trace also has RetryInvocationHandler.java so the properties I shared might help if they are supported

Copy link

@pjain1 pjain1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but CI is failing

@esevastyanov
Copy link
Author

but CI is failing

yeah, either travis env needs to be downgraded or the project's pom needs to be upgraded

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

Successfully merging this pull request may close these issues.

3 participants