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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help! I'm randomly getting '410 Gone: editDeleted' errors. What's going on? #629

Closed
SUPERCILEX opened this issue Jul 13, 2019 · 13 comments 路 Fixed by #632
Closed

Help! I'm randomly getting '410 Gone: editDeleted' errors. What's going on? #629

SUPERCILEX opened this issue Jul 13, 2019 · 13 comments 路 Fixed by #632
Labels
bug Indicates an unexpected problem or unintended behavior feature:apk Involves APKs feature:bundle Involves app bundles feature:listing Involves resource generation and app metadata

Comments

@SUPERCILEX
Copy link
Collaborator

Well aren't you a little speed demon! 馃槇 Unfortunately, you're going to have to sloooowwwww down. 馃洃

Ok, so what's happening? In brief, there is such a thing as builds that run too fast. Disappointing, I know.

Workaround

Add this to your app/build.gradle.kts file:

// TODO remove
tasks.matching { it.name.startsWith("publish") }.configureEach {
    outputs.file(File(rootProject.buildDir, "gpp-hack"))
}

This basically tells gradle that tasks whose name starts with publish cannot execute in parallel. Otherwise, they would step over each other trying to write to the same output directory, project/build/gpp-hack.

I want details!

Here's the full error message:

{
  "code" : 410,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "This Edit has been deleted.",
    "reason" : "editDeleted"
  } ],
  "message" : "This Edit has been deleted."
}

This error gets thrown because of a bug in the Android Publisher API: if two requests for an edit ID occur within a few seconds of each other, the same ID will be returned. This is a problem because GPP will then try to commit that edit twice or more鈥攐nce in the first task, another time in the other task, and so on. Commiting an edit is an atomic operation, meaning the edit gets deleted and can no longer be used. Hence, the other tasks unknowingly sharing the same edit ID will end up using an invalid edit ID.

Potential solutions

  1. [IDEAL] Fix the bug in the Android Publisher server code. I'll start poking around next week, but my guess is that it's not going to be that simple.
  2. [OK] Use a shared pool of edit ID. This sucks for two reasons:
    1. Boundaries between tasks are lost. One might fail because of an incorrect configuration in another.
    2. We can't use an in-memory pool since Gradle will parallelize across processes, etc. This means we'll have to use a file-based pool which is gross.
  3. [BAD] Block any parallelization across any GPP tasks by using a slightly smarter version of the workaround above.
@SUPERCILEX SUPERCILEX added the bug Indicates an unexpected problem or unintended behavior label Jul 13, 2019
@SUPERCILEX SUPERCILEX pinned this issue Jul 13, 2019
@SUPERCILEX SUPERCILEX added feature:apk Involves APKs feature:bundle Involves app bundles feature:listing Involves resource generation and app metadata labels Jul 13, 2019
@SUPERCILEX SUPERCILEX unpinned this issue Sep 8, 2019
@ponsuyambu
Copy link

ponsuyambu commented Oct 8, 2019

After adding the workaround also, the build still fails randomly with the same error :(

@SUPERCILEX
Copy link
Collaborator Author

@ponsuyambu what version of GPP are you using?

@technoir42
Copy link
Contributor

technoir42 commented Nov 8, 2019

@SUPERCILEX we are getting this error on 2.5.0 too. We upload 1 flavor with 3 ABI splits + universal APK, hence 4 errors:

> 410 Gone
--
{
"code" : 410,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "This Edit has been deleted.",
"reason" : "editDeleted"
} ],
"message" : "This Edit has been deleted."
}
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk$ApkUploader
> 410 Gone
{
"code" : 410,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "This Edit has been deleted.",
"reason" : "editDeleted"
} ],
"message" : "This Edit has been deleted."
}
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk$ApkUploader
> 410 Gone
{
"code" : 410,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "This Edit has been deleted.",
"reason" : "editDeleted"
} ],
"message" : "This Edit has been deleted."
}
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk$ApkUploader
> 410 Gone
{
"code" : 410,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "This Edit has been deleted.",
"reason" : "editDeleted"
} ],
"message" : "This Edit has been deleted."
}

@SUPERCILEX
Copy link
Collaborator Author

@technoir42 I'm confused, what tasks are you running? If it's just one flavor, it should only be a single task which makes a conflict impossible.

@technoir42
Copy link
Contributor

We are running just one task publishProductionReleaseApk but we have ABI splits enabled so the plugin uploads 4 APKs in parallel.

@SUPERCILEX
Copy link
Collaborator Author

@technoir42 Hmmm, does this error happen every time you try and run the task? My guess is that you just have some bad state left over, but I don't understand why GPP wouldn't clean up after itself. Try running ./gradlew --stop && rm -rf build && ./gradlew clean && ./gradlew publishProductionReleaseApk in your project root. If that doesn't work, please open a new issue, fill out the template, and share the logs of running ./gradlew publishProductionReleaseApk --info -S.

@technoir42
Copy link
Contributor

technoir42 commented Nov 8, 2019

I don't think some old state could be the reason because we are uploading from CI while doing a clean build with disabled build cache. We just integrated this plugin and the very first upload failed with an error.

@SUPERCILEX
Copy link
Collaborator Author

Gotya, then something's got to be wrong with the setup (I just checked and am able to upload splits). I can't really help you without knowing the state of the project. Are all the build folders gone? What are the logs from running with --info -S?

@ccjernigan
Copy link

ccjernigan commented Nov 13, 2019

I've been frequently seeing this error message when uploading a single app bundle from my CI server, with 2.4.2 and 2.5 versions of the plug-in. (Also using Gradle 5.6.4 and AGP 3.5.2).

I do use a build cache, but I doubt that's the issue because re-triggering the build with no code changes will eventually succeed (sometimes it takes more than one try).

The task I'm using is:
./gradlew :app:publishBundle :app:packageReleaseUniversalApk

What other info might be helpful to track this down?

@ponsuyambu
Copy link

ponsuyambu commented Nov 13, 2019

I got this error suddenly even when I run the lint task. I think running parallel jobs on the CI server causes problem. I never encountered this error when there is only one job is running on the code base.

@SUPERCILEX
Copy link
Collaborator Author

@ccjernigan @ponsuyambu Dang, I didn't know it was that bad. Just to clarify, the AndroidPublisher API has limitations GPP can't really get around. These are the cases GPP should handle:

  • Modifying different apps (keyed by package name) concurrently
  • Modifying the same app in different modules concurrently as long as they're in the same Gradle build

These cases will not work:

  • Modifying the same app in separate Gradle builds concurrently (e.g. different jobs in CI)

If that's not the case for you, please share the output of a failed build run with --info -S. If possible, it would be helpful to see the state of the projectRoot/build/gpp/ directory.

@tasomaniac
Copy link

tasomaniac commented Mar 25, 2020

I ended up here after seeing this issue in our build.

Ours was because Jenkins CI was running 2 full builds in parallel and coincidentally GPP tasks were running at the same time. They were overriding each other.

@Chuck-Townsend
Copy link

I thought that this change: #632 would fix the problem but I'm using v2.4.2 which includes that change and the problem still exists. Like tasomaniac, I can see the problem when running 2 Jenkins CI publishing builds on two different agents at the same time, publishing different apps to different tracks using the same google play credientials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior feature:apk Involves APKs feature:bundle Involves app bundles feature:listing Involves resource generation and app metadata
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants