Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ else if (line.contains("@ERROR:") || line.contains("rsync error:")) {
case HOST_DROPPED: // socket/stream drop (10/12/20)
mainHandler.post(() -> listener.onError(context.getString(R.string.rsync_error_host_dropped)));
break;
case KILLED: // ADFA-4496: SIGKILL (137) -> phantom-process killer reaped the transfer
mainHandler.post(() -> listener.onError(context.getString(R.string.rsync_error_process_killed)));
break;
default:
mainHandler.post(() -> listener.onError(context.getString(R.string.rsync_error_exit_code, exitCode)));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ public enum Transfer {
COMPLETE,
/** socket/stream drop — the peer went away (10/12/20). */
HOST_DROPPED,
/** process terminated by a signal — e.g. Android's phantom-process killer (SIGKILL). */
KILLED,
/** any other non-zero exit. */
ERROR
}

/**
* True when the exit code indicates the process was terminated by SIGKILL (137 = 128 + 9).
* On Android 12+ this is the signature of the phantom-process killer reaping a long-running
* native child (the rsync transfer/daemon). ADFA-4496.
*/
public static boolean wasKilledBySignal(int exitCode) {
return exitCode == 137;
}

/** True for the exit codes treated as a successful transfer (0, 23, 24). */
public static boolean isSuccess(int exitCode) {
return exitCode == 0 || exitCode == 23 || exitCode == 24;
Expand All @@ -35,6 +46,7 @@ public static boolean isSuccess(int exitCode) {
public static Transfer classifyTransfer(int exitCode) {
if (isSuccess(exitCode)) return Transfer.COMPLETE;
if (exitCode == 10 || exitCode == 12 || exitCode == 20) return Transfer.HOST_DROPPED;
if (wasKilledBySignal(exitCode)) return Transfer.KILLED;
return Transfer.ERROR;
}
}
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,5 @@
<string name="crash_report_subtitle">¿Enviar este reporte para ayudarnos a corregirlo? Puedes revisar abajo qué se incluye.</string>
<string name="crash_report_send">Enviar reporte</string>
<string name="crash_report_dismiss">Descartar</string>
<string name="rsync_error_process_killed">Android detuvo el proceso de transferencia (límite de procesos en segundo plano). Para evitarlo, activa «Desactivar restricciones de procesos secundarios» en Opciones de desarrollador, o configura ADB.</string>
</resources>
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,4 +551,5 @@
<string name="crash_report_subtitle">Envoyer ce rapport pour nous aider à corriger ? Vous pouvez vérifier ci-dessous ce qui est inclus.</string>
<string name="crash_report_send">Envoyer le rapport</string>
<string name="crash_report_dismiss">Ignorer</string>
<string name="rsync_error_process_killed">Android a arrêté le processus de transfert (limite de processus en arrière-plan). Pour l’éviter, activez « Désactiver les restrictions des processus enfants » dans les options pour développeurs, ou configurez ADB.</string>
</resources>
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,4 +551,5 @@
<string name="crash_report_subtitle">इसे ठीक करने में मदद के लिए यह रिपोर्ट भेजें? नीचे देखें कि क्या शामिल है।</string>
<string name="crash_report_send">रिपोर्ट भेजें</string>
<string name="crash_report_dismiss">खारिज करें</string>
<string name="rsync_error_process_killed">Android ने ट्रांसफ़र प्रोसेस रोक दी (बैकग्राउंड प्रोसेस सीमा)। इसे रोकने के लिए, डेवलपर विकल्प में “चाइल्ड प्रोसेस प्रतिबंध अक्षम करें” चालू करें, या ADB सेट करें।</string>
</resources>
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -553,4 +553,5 @@
<string name="crash_report_subtitle">Enviar este relatório para ajudar a corrigir? Você pode revisar abaixo o que está incluído.</string>
<string name="crash_report_send">Enviar relatório</string>
<string name="crash_report_dismiss">Dispensar</string>
<string name="rsync_error_process_killed">O Android interrompeu o processo de transferência (limite de processos em segundo plano). Para evitar isso, ative “Desativar restrições de processos filhos” nas Opções do desenvolvedor, ou configure o ADB.</string>
</resources>
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,5 @@
<string name="crash_report_subtitle">Отправить этот отчёт, чтобы помочь исправить? Ниже можно посмотреть, что включено.</string>
<string name="crash_report_send">Отправить отчёт</string>
<string name="crash_report_dismiss">Отклонить</string>
<string name="rsync_error_process_killed">Android остановил процесс передачи (ограничение фоновых процессов). Чтобы избежать этого, включите «Отключить ограничения дочерних процессов» в параметрах разработчика или настройте ADB.</string>
</resources>
1 change: 1 addition & 0 deletions controller/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,5 @@
<string name="crash_report_send">Send report</string>
<string name="crash_report_dismiss">Dismiss</string>
<string name="feedback_force_crash" translatable="false">Force test crash (debug)</string>
<string name="rsync_error_process_killed">Android stopped the transfer process (system background-process limit). To prevent this, enable “Disable child process restrictions” in Developer options, or set up the ADB optimization.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ public void otherCodesAreError() {
assertEquals(RsyncOutcome.Transfer.ERROR, RsyncOutcome.classifyTransfer(c));
}
}

@Test
public void sigkillIsClassifiedAsKilled() {
assertTrue(RsyncOutcome.wasKilledBySignal(137)); // 128 + SIGKILL(9)
assertFalse(RsyncOutcome.wasKilledBySignal(143)); // SIGTERM is our own destroy()
assertFalse(RsyncOutcome.wasKilledBySignal(1));
assertFalse(RsyncOutcome.isSuccess(137));
assertEquals(RsyncOutcome.Transfer.KILLED, RsyncOutcome.classifyTransfer(137));
}
}