[prev in list] [next in list] [prev in thread] [next in thread]
List: fossil-users
Subject: Re: [fossil-users] db errors after Ctrl-C
From: rosscanning () fastmail ! com
Date: 2016-12-14 5:28:10
Message-ID: 1481693290.449327.818390537.1B9FFA83 () webmail ! messagingengine ! com
[Download RAW message or body]
Unfortunately, the bug is a proper Heisenbug, and refuses to manifest at
all under the debugger.
I read up on the behaviour of Ctrl-C under Windows, here:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx
and it's supposed to work like this:
1) If no handler is installed (as in Fossil), Windows spawns a new
thread within the process.
2) That thread calls ExitProcess()
3) ExitProcess() stops every thread except itself, and then does a bunch
more shutdown stuff.
Meanwhile, the code in Fossil that prints the "abandoning commit"
message does the following:
1) Calls fossil_fatal()
2) fossil_fatal() prints the message, calls db_force_rollback(), and
then fossil_exit().
3) fossil_exit() calls db_close(), then exit()
So my wild-ass guess is that there is a race condition between the
shutdown sequence being executed by fossil_fatal(), and the shutdown
sequence being executed by the spawned thread. Maybe the spawned thread
is closing file handles just before fossil_fatal() tries to access them?
That would explain the "invalid file handle" message that I sometimes
see.
This SO answer:
http://stackoverflow.com/questions/915312/different-ways-of-exiting-a-process-in-c
indicates that returning from main() is the preferred method of shutting
down in Windows, so I might see if I can hack Fossil to do that, and see
what happens.
On Wed, Dec 14, 2016, at 08:22 AM, Richard Hipp wrote:
> On 12/13/16, rosscanning@fastmail.com <rosscanning@fastmail.com> wrote:
> > SNIPPET 1
> > C:\Users\Ross\src>fossil commit -m "created"
> > ./math/src/transforms.rs contains mixed line endings. Use --no-warnings
> > or the "crnl-glob" setting to disable this warning.
> > Commit anyhow (a=all/c=convert/y/N)?
> > *** I hit Ctrl-C here ***
> > Abandoning commit due to mixed line endings in ./math/src/transforms.rs
> > SQLITE_MISUSE: API call with invalid database connection pointer
> > SQLITE_MISUSE: misuse at line 138842 of [707875582f]
> > ^C
>
> Can you run fossil in a debugger - set a breakpoint on the
> fossil_sqlite_log() function, then provoke the behavior above. When
> you hit the breakpoint, capture a stack trace and post it to the list.
> That will probably make the problem obvious.
> --
> D. Richard Hipp
> drh@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic