Am Mittwoch, 11. September 2013, 11:59:46 schrieb France Baril:
Now, my impression is that something happens when the collection is deleted that leaves the DB in a different state than the one it was in before the collection existed. This 'something' causes the crash to occur.
You are right: the problem is not due to the missing ~webdav database - the stack trace for ~webdav is only there, because the implementation of db:exists() tries to open the database and an exception is generated (I hope will have the time to change this).
All debug traces (file:write/append) get written and all files have HTML content. So the next step would be to exit the function and go back to the calling function for the db:output... I never seem to get out if the functions are called after the deletion of a collection.
Unfortunately, the debug output is not very useful in this case of updates, because all updates within a single query are first accumulated in the so called "pending update list" [1] and are applied only at the end of the execution. Therefore, you can't determine which update causes the crash.
Is there anything else that I can provide that would help identify the issue? I really don't know what else to try. The crash occurs between the end of the function and the callback to the calling function... and only when the target collection has been deleted. Any clue will be useful.
Corrupted database problems are hard to debug, especially when no data is present to reproduce the error. Therefore, I would suggest the following:
1. try to change your code so that you don't store the documents in a collection, but rather in a separate database; when you need to delete all documents, simply drop the database and re-create it with the new set of documents; from a user point of view it is not a huge difference if you use a database with several collections or just several databases.
2. alternatively, try to reproduce the error and send sample data and code so that we can reproduce and analyze it, too; please, also assert that the database is not accessed simultaneously from different processes (e.g. BaseX GUI and BaseX web server) - this should be no longer cause troubles, but just in case.
Best regards, Dimitar
[1] http://www.w3.org/TR/xquery-update-10/#dt-pending-update-list