Sync need improvements

This has been brought up many times, to no satisfactory resolution. After playing with local library synchronization for couple of days I have very good understanding of problem causes. Summary: EXTREMELY bad software implementation.

In detail:

  1. Synchronous calls block.

This is the key cause of long synchronization problem. All is good as long as serialized disk files are 100% (i.e. readable FLAC), or if serialization medium (i.e. portable USB drive) has no damaged sectors. But as soon as you run into a problem OS API call to parse FLAC will block WITHOUT TELLING YOU WHAT IS GOING ON, until it times out 10+ minutes later. Example of log line that eventually comes back indicating the culprit:

2023-10-22 21:34:06.996 [warning]: Local Library Sync: Not synching unreadable file /Volumes/CD Music/Pink Floyd/The Early Years Cre-ation/Disc 1/01 - Pink Floyd - Arnold Layne.flac

SOLUTION: Software should NEVER block. If you have sync API call (such as Disk I/O) that can potentially hang, you run it on a thread. Then if thread doesn’t come back in reasonable time (10-15 sec tops for simple I/O) you kill it, and log the problem. Don’t wait 10+ minutes!!!

As soon as I re-scan offending FLAC all is good. Now picture local libraries of several TB which will have fair amount of bad files. This is why sync is going on for days for some people.

2) Database Issues

In back-end Audirvana builds small SQLITE database (on Mac it will be in /Libraries/Application Support/Audirvana). But if you run Audirvana from command line (MAC :: Applications :: Audirvana :: Show Package Contents :: Mac OS – then drag&drop Audirvana Studio into shell), all kinds of database nonsense is logged. Frequently:

2023-10-22 21:48:58.780 Audirvana Studio[65697:1695272] +[CATransaction synchronize] called within transaction

This is happening even when there is no apparent synchronization. Audirvana is doing something bad in the background, guarding with standard BEGIN TRANSACTION … END TRANSACTION Sql construct. Then some other part of the system tries to do similar thing and basically non-reentrant code blocks until someone finishes and releases the mutex

I am also seeing occasional “Foreign Key Constraint Failed”. Example:

2023-10-22 21:41:42.156 [warning]: update for track rollback Atom Heart Mother [Live In Montreux 1970 ] result: FOREIGN KEY constraint failed

This is typical relational database issue, leading me to believe Tables have not been normalizes properly

This is another reason for long synchronization times

3. Automatic synchronization problem

Even if File System has not been modified (no songs added or removed), Audirvana will start re-sync of entire USB drive. Logged Reason: Portable Disk UUID has changed (???). Example:

2023-10-22 17:10:40.684 [warning]: Synched folders initialization: Device UUID changed (disk replacement?), from C5396D06-F030-4669-9C22-EF3903F6B36F to FE6AACE5-DEE1-4B57-937F-7CCBC8A82791 resynching all folder /Volumes/CD Music

SOLUTION: You ABSOLUTELY need to provide ability to disable Automatic sync. I am the user and I know what I changed, so let me trigger sync when I want not when you think it should be done. This is one of most common principles of friendly and responsive Use Case design.

4. Sorting Nightmare

In Artist view Audirvana automatically sorts albums by Timestamp, by putting newest in top left corner. All kinds of mess results: Some CDs don’t have timestamp, some are re-issues and have invalid (newer) Timestamp, etc. I have workaround by editing timestamps of all CDs to the order I want, but this is very long and cumbersome process. In addition, it gets synced back to serialization Medium (as well as Database), which – you guessed it: Frequently hangs

SOLUTION: Provide UI friendly mean to re-order albums in Artist view by simple drag & drop.

I am writing all this while waiting for Audirvana sync to come back and tell me why it is hanging (which FLAC it didn’t like). (I am scanning artist by artist, because if you scan from the root you can wait forever) Friendly suggestion:

If you have commercial software you are selling licenses for, it needs to have commercial quality. I worked 25+ years with software and designed/implemented many systems substantially more complex than simple Library sync. First thing you should really do is pull out whole synchronization mess into separate module (separate app on Mac, or Exe /DLL on Win), then work on issues without impacting rest of the system (i.e. playback). It likely needs to be rewritten from scratch.

This long note is written with best intentions, because rest of system is good. UI is quite decent and playback quality good.