Skip to content

[Bug] multiple functional / concurrency issues #998

@solf

Description

@solf

Guidelines

  • I have read the FAQ and it doesn't cover the issue.
  • I have searched the issue tracker for open and closed issues that are similar to the feature request I want to file, without success.
  • I'm on the latest version.
  • I'm not using a test build (alpha/beta/release-candidate).
  • This issue contains only one bug.

Describe the bug

Preface1: I 'lied' on the checklist above because I'm not realistically going to create separate bug reports for this.

Preface2: I'm Java software engineer, but my knowledge of Android and Kotlin is very-very limited. Nevertheless I had real functional problems with the app and I tried to fix them (mostly using Cursor and reviewing the results).

The code with the fixes (and some other stuff unfortunately) is here: https://github.com/solf/Neo-Backup/tree/no-debug-log

Functional problems:

  • Scheduled backup fails to properly detect 'end of backup' and hangs around forever with notification & holding wakelock. The problem is in ScheduleWork -- observer pattern is used to try to figure out when all tasks have finished and somehow it never gets to the required number. I don't know why, perhaps because of tasks database pruning. I ended up completely redoing this to use the same approach as the 'progress indicator notification' and it works reliably. This is likely also reported in [Bug] persisting notification #997
  • fetching_action_list notification is created in ScheduleService and is not cancelled; if you're lucky, it gets overwritten by notifications in ScheduleWork (because current time is used as notification id); if you're not lucky -- it sticks around.
  • Enforce backup limit batch option outright doesn't work (says nothing to trim). Fix is in ToolsPrefsPage (I have no idea why it works like this, it's Cursor's doing).
  • I had issues with the same scheduled backup starting to execute concurrently for unknown reasons causing quite a mess; I've added stuff to ScheduleService to try to prevent this.

Other potential problems

  • A lot of notifications just use current timestamp as an id -- this is very unreliable (may collide); I've added generateUniqueNotificationId() in NotificationHandler
  • NeoApp.wakelock management doesn't guard against going negative (due to improper usage), I've added code to clamp to zero
  • WorkHandler uses lots of thread-unsafe vars/access; I'm not sure, maybe it's fine, but Cursor didn't think so, so I rewrote it with atomics and such
  • I've disabled wakelock management in AppActionWork because they're entirely redundant.

Expected Behavior

Hopefully someone will consider integrating my fixes or better yet fixing the issues properly.

Neo Backup's Version

8.3.14

Installation Source

Github/Codeberg/Gitlab releases

Last Known Working Version

No response

Relevant information

  • Device:
  • Android Version:
  • ROM: (AOSP, CalyxOS, MIUI, GOS...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions