Error message seen on the first attempt to run this query anonymously:
unknown job being polled!
The second attempt to run the query was successful.
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.Sign up to join this community
When you click "Run Query" there is a bit more going on then just sending the SQL statement to SQL Server and then wait for the query to complete and return you the results.
Instead, "Run Query" only schedules a Task. The task will eventually either time out or return the query result. The task gets a JobId and that JobId is returned to your browser. Your browser will then periodically (every 1,5 seconds) send a "Poll Job" request with the given JobId to the server. On the server an in-memory list of current running Tasks for all users is maintained. When a "Poll Job" comes in the server takes the Job Id and searches in the tasks list for the right task. When it find it, it will return its current state and/or result or null if no task with the given JobId can be found. An Unknown Job was being polled, and so that is the error you get.
There are a few race-conditions (not the Verstappen kind of conditions) at play here that can lead to your task being removed from the Task list.
You can remove the task yourself by clicking the Cancel button. That will tell the server you're no longer interested in the result of the Job. In some cases, where we expect to have results, we Poll the job one last time. If the server did a clean-up run by then, you get the unknown job being polled. The server removes Tasks that exceed the 2 minute allotted run-time. If your browser missed the two-minute mark and polls the server after the clean-up ran, an unknown job is polled again.
The error is just an indication that something the browser wants from the server is no longer there. You might just have missed its result. Hitting "Run Query" again often resolves the issue, specially if the previous Run Query attempt did run to completion. In that case the Task creation returns a task with the result already on it, in which case no Polling of Jobs is needed.