Sorry - my bad! I believe your analysis is 100% correct, and I was wrong about some of my earlier test configurations having reproduced the problem without SQLITE_DEBUG set. I will shortly re-run all my regression tests with: ifeq (1,$(ENABLE_ASSERTIONS)) CFLAGS += -DSQLITE_ENABLE_API_ARMOR CFLAGS += -DSQLITE_DEBUG endif changed to something like: ifeq (1,$(ENABLE_ASSERTIONS)) && NOT TSAN && NOT VALGRIND CFLAGS += -DSQLITE_ENABLE_API_ARMOR CFLAGS += -DSQLITE_DEBUG endif Please consider this resolved, unless you hear back in the next day or so. THANKS! And sorry for troubling you with an errant report. (note - if lots of other people run into this mistake you might want to add locks on that increment or find some other way to avoid this issue in debug builds).