Devices need to be deleted in order to release their IDs/EUIs for future registrations. Due to the way our registries work, deleting an application does not implicitly delete devices under that application, so users need to delete their devices explicitly before deleting an application. The v2 console tries to delete devices, but there are not guarantees that this succeeds. The v2 CLI (ttnctl) does not try to delete devices.
The reason for all this is that in our v2 backend, applications are registered in the account server while end devices are registered in the networkserver (through the broker) and in the handler. The account server doesn’t know anything about end devices, so it also can’t check if a user deleted all their end devices before deleting the application. The networkserver and handler don’t know anything about applications other than the fact that a user is authorized to manage end devices with a certain application ID and read their traffic. As a result of this, the only effect of deleting an application is that a user is no longer authorized to manage those end devices or read their traffic. The end devices will not disappear, and the routing services will keep handling traffic for those devices
In our v3 stack, the situation is very similar to v2. Users (or clients like the CLI or console) will still be responsible for deleting registered devices before deleting an application. We will however be better able to detect if there are still devices registered, and refuse to delete the application if we do.
For v3 we are also thinking about some kind of mechanism for releasing identifiers of orphaned end devices or end devices that have exceeded their lifetime, but we don’t have anything concrete for this yet.