There are some bruuuutal contracts out there (Luol Deng, Ryan Anderson) but not many are as bad as this one.
Wouldn't be surprised if Melo negotiates a buyout and joins either LeBron or CP3 as a 6th man in their next stop. Melo is on the decline but can at least still score and contribute. As bad as 27.3 mil appears, it at least is expiring this year.
Deng and Anderson have 2 years left making them virtually untradable and neither can even get on the floor. I'd argue they are worse situations.