fix(nft): the per-batch markersAdded() call is not guarded against re-entry
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with NFTDetector.h and the per-batch markersAdded() call at the end of addNFTMarkers(); compare it with the guarded calls in ensureDetector() and the creation backfill. Then add tests for a second batch whose callback calls teardown() and addNFTMarkers(). Decide and document the outcome for already committed markers, and verify that nested calls are refused and the detector remains alive until its callback returns.
Written by the indexing model from the issue text.
Description
NFTDetector.h says that a call back into the core from markersAdded() is refused before it changes anything, and that the outer addNFTMarkers() / setupAR2() fails. That holds for the calls made from ensureDetector(), the backfill at creation, which runs under CreatingGuard. But the per-batch call at the end of addNFTMarkers() runs outside the guard:
if (batchSize > 0 && this->detector) {
this->detector->markersAdded(markerIds, datasetPathnames);
}
From there, teardown(), setupAR2() or setCamera() is not refused. It destroys the detector while its markersAdded() is still running, which is undefined behaviour. addNFTMarkers() recurses.
Found by Qodo on #129. Introduced by #116; #124 added the guard for the creation path only. It only shows with a detector that breaks the documented contract, so it does not block 0.13.0.
To decide
When the per-batch call runs, the batch is already committed: ids are assigned and the KPM reference data is set. Returning {} at that point would report a failure for markers that are loaded. Options:
- refuse the nested call, discard the detector, log, and still return the ids, so the next
setupAR2()recreates the detector; updateNFTDetector.hto say so; - or notify before committing, and roll back if the detector re-entered.
Fix sketch
Share the RAII guard of ensureDetector() with the per-batch call. Afterwards, check creationReentered and whether the detector or the handles changed.
Test
A second batch whose markersAdded() calls teardown(), and separately addNFTMarkers(). The nested call must be refused, the detector must stay alive until its callback returns, and the outcome must match the chosen contract.
- Dominant language
- C++
- Stars
- 21
- Forks
- 8
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from webarkit/WebARKitLib
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
webarkit/WebARKitLib#131 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
webarkit/WebARKitLib#114 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 93/100
webarkit/WebARKitLib#107 ·
Maintainers usually reply within 1 day
-
build: native build fails with GCC 15 (ubuntu-26.04): implicit fopen64 in vendored ioapi.cPossibly taken @kalwalt claimed this 6 days ago. Openbug CI
webarkit/WebARKitLib#118 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
feat(nft): let a consumer supply its own NFTDetectorPossibly taken @kalwalt claimed this 6 days ago. OpenC/C++ code documentation Emscripten enhancement
webarkit/WebARKitLib#115 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in webarkit/WebARKitLib
Similar issues
-
bug fixed form parser medium priority tokenizer
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
compatibility prio:normal
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NatronGitHub/openfx-misc#320 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
agent-ready area:analysis bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
pauljohanneskraft/Acai#609 ·
Maintainers usually reply within 10 days