Unable to sign out of iCloud, sign in to App Store, or use iMessage. High Sierra I am unable to sign in or out on iCloud or the App store. Whatever app I am using (Sys Prefs, App Store) loops endlessly. I can quit Prefs, but have to force quit the App Store. iMessage operates but all messages are marked as undelivered. Virtually all documents stored in iCloud drive do not appear in the Finder, but are available through the web (iCloud) interface. All of this works fine in my test account, so it's not a S/N issue, but switching everything to the test account is not an option.

I have deleted assorted caches and prefs. Enabled/Disabled iCloud Keychain, tried (unsuccessfully) signing out of iCloud while off line, and probably a few other things that I can't remember.

Mid-2012 15" MBP 16GB. 10.13.1
Finally was able to get this sorted. It turns out that deleting the Keychain through Keychain Access prefs is insufficient. I needed to go to ~/Library/Keychains, open the folder with the Keychain, and drag the contents to the trash (or to a folder on the Desktop). Logging out and back in solved everything.