I launched a program (Apple's Feedback Assistant) on Big Sur that uploads files to Apple via nsurlsessiond. I neglected to observe that one of the files was >500MB, and after I submitted it, I wanted to cancel the upload. Note that the upload proceeds in the background (i.e., even after I quit Feedback Assistant).
I cannot find any user interface to cancel it. Meanwhile, the upload kept running in the background for hours.
Following the advice at How to know what nsurlsessiond is downloading I ran
sudo lsof | grep nsurl
and was able to spot what I believe is the large upload file at:
/private/var/folders/bh/sqXXX/0/com.apple.nsurlsessiond/XXX/XXX/Uploads/CFNetworkUpload_XXX
(where XXX represents a long string of characters and/or hex digits).
I cannot access the enclosing folder, even if I give Full Disk Access to Terminal or enable the root account and log in to that. I keep getting "Operation not permitted". (I haven't tried disabling SIP, which I am reluctant to do.) Even if I could get access to the folder, it is only a guess that deleting the file to be uploaded would give the desired result - it might also cause nsurlsession to stop working altogether, which would be bad.
I was eventually able to stop the upload, by using Little Snitch to identify the endpoint of the upload (cssubmissions.apple.com) and deny that.
It's still waiting to keep sending that big file, though. If I reboot, it's still there. If I turn off the rule blocking that domain, then a little while later the upload starts up again.
I'd like a better way to cancel that upload and see that half-gigabyte file go away.