# Problem cancelling vtkStlReader

**URL:** https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362
**Category:** Development
**Created:** [March 27, 2026, 10:51pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362 "2026-03-27T22:51:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![arey505](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@arey505](https://discourse.vtk.org/u/arey505)
#### Post date: [March 27, 2026, 10:51pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/1 "2026-03-27T22:51:50Z")

</div>

I am running the vtkStlReader in a background thread to load a very large stl file. I would like to allow cancelling during the Update() call execution. I have tried calling the reader’s AbortExecuteOn() method, but that does not seem to cancel it. Is this the correct method of cancelling the execution of the Update() call? Can the call be cancelled or does it have to run to completion?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [March 28, 2026, 1:03pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/2 "2026-03-28T13:03:04Z")

</div>

Hi @arey505

Your approach sounds correct to me as long as you call `AbortExecuteOn()` from a thread different than the one running `vtkSTLReader::Update()`.

The thing is a `vtkAlgorithm` subclass must call `CheckAbort()` a few times to detect the need to abort. See this release note from v9.3.0 for details - [9.3 - VTK documentation](https://docs.vtk.org/en/latest/release_details/9.3.html#filters-filters)

From a quick glance at the [vtkSTLReader.cxx](https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Geometry/vtkSTLReader.cxx), it does not call `CheckAbort` at all. That is likely the reason why you cannot cancel it. Would you be interested in improving this?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [March 30, 2026, 11:41am UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/3 "2026-03-30T11:41:53Z")

</div>

> [@jaswantp](#):
>
> From a quick glance at the [vtkSTLReader.cxx](https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Geometry/vtkSTLReader.cxx), it does not call `CheckAbort` at all. That is likely the reason why you cannot cancel it. Would you be interested in improving this?

Correct.

@arey505 please open an issue on VTK gitlab: [https://gitlab.kitware.com/vtk/vtk/-/work\_items?sort=created\_date&state=closed&search=9.6.1&first\_page\_size=100](https://gitlab.kitware.com/vtk/vtk/-/work_items?sort=created_date&state=closed&search=9.6.1&first_page_size=100)

---

<div class="post-metadata">

### Author: ![arey505](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@arey505](https://discourse.vtk.org/u/arey505)
#### Post date: [March 30, 2026, 8:25pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/4 "2026-03-30T20:25:58Z")

</div>

Yes, I would be interested in improving this. Can you tell me how I would go about it? It looks to be a minor change to add CheckAbort() calls to the vtkSTLReader class

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [March 30, 2026, 8:30pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/5 "2026-03-30T20:30:43Z")

</div>

Yes, the development happens on [gitlab.kitware.com/vtk/vtk](http://gitlab.kitware.com/vtk/vtk). Please see [Develop - VTK documentation](https://docs.vtk.org/en/latest/developers_guide/git/develop.html) on how to get started.

---

<div class="post-metadata">

### Author: ![arey505](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@arey505](https://discourse.vtk.org/u/arey505)
#### Post date: [March 30, 2026, 8:51pm UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/6 "2026-03-30T20:51:23Z")

</div>

entered issue #20007

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [March 31, 2026, 8:04am UTC](https://discourse.vtk.org/t/problem-cancelling-vtkstlreader/16362/7 "2026-03-31T08:04:49Z")

</div>

[https://gitlab.kitware.com/vtk/vtk/-/work\_items/20007](https://gitlab.kitware.com/vtk/vtk/-/work_items/20007)
