Hello,
My SQL Developer version is 19.4 and my DB version is 12.2.
I made the same mistake as using the same connection for monitoring the sessions (Tools -> Monitor Sessions) as one that was already busy running something in a worksheet. In this case SQL Developer pops up this window:

And waits for the other operation to finish to display the monitor sessions screen. Even if I choose "Cancel Task", this window doesn't disappear. It will continue running until the other task has completed. Clicking on the cross and cancelling again sometimes works. So could the "Cancel Task" button effectively cause the task to be cancelled immediately?