Add more assertions about uncommitted sqlite transactions.

I think we were sometimes leaving half-done sqlite transactions sitting
around for a long time (eg. across sub-calls to .do files).  This
seemed to be okay on Linux, but caused sqlite deadlocks on MacOS.  Most
likely it's not the operating system, but the sqlite version and
journal mode in use.

In any case, the correct thing to do is to actually commit or rollback
transactions, not leave them hanging around.

...unfortunately this doesn't actually fix my MacOS deadlocks, which
makes me rather nervous.
This commit is contained in:
Avery Pennarun 2018-10-06 04:36:24 -04:00
commit 613625b580
5 changed files with 35 additions and 2 deletions

View file

@ -32,9 +32,13 @@ try:
for t in targets:
f.add_dep('m', t)
f.save()
state.commit()
rv = builder.main(targets, should_build)
finally:
jwack.force_return_tokens()
try:
state.rollback()
finally:
jwack.force_return_tokens()
except KeyboardInterrupt:
sys.exit(200)
state.commit()