A user clicks zoom twice, and the PDF page disappears. The console reports that the same canvas is already in use by another render operation. A viewer can hit this when a new zoom, rotation, or page selection starts drawing before the previous PDF.js render has finished.
The tricky part is that cancel() starts cancellation; it does not make every asynchronous step in your viewer disappear. You still need to wait for the render task's promise to settle before reusing that canvas. You also need to ignore older page requests that finish loading after a newer request has arrived.
A race with two different clocks
Suppose the user selects page 3, then immediately selects page 4. Both getPage() calls run asynchronously. Page 4 can become available first, while the older page 3 request is still pending.…