In normal operation, the write transaction should always be NULL here, so this specific point in the code should never be reached! Exception: exiting because of signal handler. So I do not see a race here.