Bluetooth OTA fails: iOS DFU Library complains that Image 0 (slot 1) is already pending

We are suddenly getting lots of cases where devices aren't able to perform Bluetooth OTA via our iOS app. 

Primarily this is what we are seeing is this: `error=There is no free slot to place the image`.

First we start the update:

This is what the image list response right before this looks like:

dfu: Image List response:
  Header:
    version   : "1"
    op        : 1
    flags     : 0
    length    : 248
    group     : 1
    seqNum    : 60
    commandId : 0

  Payload:
    images:
      - bootable  : true
        hash      : 0xAA00383B0829FA8BA63CC09BD126D7CBEF866D9A8DD8C9BFD176EE13A8FDAAA6
        active    : true
        permanent : false
        slot      : 0
        version   : "0.0.101"
        confirmed : true
        pending   : false

      - version   : "0.0.103"
        hash      : 0xA576F7F8B294DA3A26979D8846E0D2CCE6454370F8A57B0E9C7053EDD5526884
        active    : false
        slot      : 1
        pending   : true
        permanent : false
        bootable  : true
        confirmed : false

    splitStatus : 0

The library throws this error:

We also see `dfu: Image 0 (slot 1) is already pending.`

but proceeds to upload image. Device then restarts upon upload completion but seems to restart on the old firmware, showing the same image list. A further update attempt throws this error:

dfu: There is no free slot to place the image

and stops the update.

We use a `testOnly` strategy (not testAndConfirm) from the library so that we confirm the image in the app. This was working quite fun for a few months until now.  

We see this commit which attempted to fix a similar issue but it seems like it did not resolve this specific case. Also saw this devzone ticket but we didn't make any changes to pm_static.yml and how the secondary slot is allocated. 

We also tried force testing the image stuck in secondary slot using `mcumgr` with no luck. 

Related