1. Beatrix Willius
  2. Valentina Database ADK
  3. Среда, Октябрь 24 2018, 06:37 AM
  4.  Подписаться через email
I've got a single customer whose journal file isn't deleted when quitting.

Here is my code


try
theDatabase.Close
theDatabase = nil
catch err as VException
if err.ErrorNumber = 394507 then
'just ignore
end if
end try

'make sure that the journal file is really deleted
if DBFolderitem <> nil then
dim JournalFile as FolderItem = DBFolderitem.Parent.Child(DBFolderitem.Name + ".journal")
if JournalFile <> nil and JournalFile.Exists then
'extra logging
Globals.theErrorLog.logitem(currentMethodName + " " + JournalFile.NativePath)
JournalFile.Delete
''extra logging
Globals.theErrorLog.logitem(currentMethodName + " " + str(JournalFile.LastErrorCode))
end if
end if


The data from the session log shows that the journal file is still there. Even the ".delete" doesn't help even if the last error code is 0.

2018-10-23, 19:48:57 MainWindowController.CheckForQuit
2018-10-23, 19:48:57 DBWindow.CloseArchive
2018-10-23, 19:48:57 MainWindowController.CloseArchive
2018-10-23, 19:48:57 MaxModel.CloseArchive
2018-10-23, 19:48:57 MaxModel.CloseArchive done
2018-10-23, 19:48:57 MainWindowController.CloseArchive done
2018-10-23, 19:48:57 MainWindow.CloseDB
2018-10-23, 19:48:57 MainWindow.CloseDB /Users/christian/Mail Archive.vdb.journal
2018-10-23, 19:48:57 MainWindow.CloseDB 0
2018-10-23, 19:48:57 MainWindow.CloseDB done
2018-10-23, 19:48:57 DBWindow.CloseArchive done


When the user only closes the database the journal file is deleted. I think that there may be a relationship to a bug in Xojo that makes 64bit apps not quit. As workaround I have to use a declare to quit my app:


declare function NSClassFromString lib "Cocoa" ( aClassName as CFStringRef ) as integer
declare function sharedApplication lib "Cocoa" selector "sharedApplication" ( classRef as integer ) as integer
declare sub terminate lib "Cocoa" selector "terminate:" ( appRef as integer, sender as integer )

Dim appInstance as integer = sharedApplication( NSClassFromString( "NSApplication" ) )
terminate( appInstance, appInstance )


Any idea what I could do to make sure that the journal file is deleted before the quit is done?

Xojo 2018r1, Valentina 8.3.3.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Комментарий
There are no comments made yet.
john smith Ответ принят
I have also faced the same problem when I accessing those things on my iPhone e then my iTunes account doesn't respond and it shows me an error that is iTunes error 4013iTunes error 4013 so if anyone has any idea then please suggest me.:o
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
And the clone issue really seems to be related:

- The user had made a clone.
- The user moved the clone to the trash.
- On trying to clone again to the same location there is an error -47.

2018-10-23, 10:15:00 PM --------------------------
2018-10-23, 10:15:00 PM An error happened:
2018-10-23, 10:15:00 PM Class/Method: DBUtilities.CloneDatabase
2018-10-23, 10:15:00 PM Time: Tuesday, October 23, 2018 10:15:00 PM 3020319
2018-10-23, 10:15:00 PM Type of Error: VException -47
2018-10-23, 10:15:00 PM --------------------------
2018-10-23, 10:15:00 PM Stack:
2018-10-23, 10:15:00 PM
Sub VDatabase.Close()
Function DBUtilities.CloneDatabase(boolean) as boolean
Sub DBUtilities.CompactDatabase()
Sub MaxModel.DatabaseCompact()
Sub MainWindowController.DatabaseCompact()
Function DBWindow._databaseCompactNew_Action() as boolean
Sub Application._CallFunctionWithExceptionHandling()
2018-10-23, 10:15:00 PM Stack done
2018-10-23, 10:15:00 PM ErrorReportWindow.Constructor
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
Made a Mantis issue: http://www.valentina-db.com/bt/view.php?id=8390

You can delete the Google+ link in your footer, by the way.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
The plot thickens. Made some new code, that has proper exception handling and uses NSWorkspace to delete the journal file if it's still there:


try
theDatabase.Close
theDatabase = nil
catch err as VException
Globals.theErrorLog.DialogErrorProceed(app.kErrorValentina + " " + str(err.ErrorNumber) + " " + err.Message)
end try

'make sure that the journal file is really deleted
if DBFolderitem <> nil then
app.SleepCurrentThread(100)
dim JournalFile as FolderItem = DBFolderitem.Parent.Child(DBFolderitem.Name + ".journal")
if JournalFile <> nil and JournalFile.Exists then
'extra logging
Globals.theErrorLog.logitem(currentMethodName + " " + JournalFile.NativePath)

'delete journal file with NSWorkspaceMBS
dim source,dest as FolderItem
source = JournalFile.Parent
dim files(-1) as string
files.Append JournalFile.name
dim b as Boolean = NSWorkspaceMBS.performFileOperation(NSWorkspaceMBS.NSWorkspaceRecycleOperation, source, dest, files, 0)
if not b then Globals.theErrorLog.LogItem "It wasn't possible to delete the JournalFile"
end if
end if


The user reported back that he got an error -47, which is "File is busy", as error message on close. However, the NSWorkspace operation was able to move the file to the trash.

Could this be a Mojave problem? We have seen with Xojo that the newer versions of macOS like to hang on files. For Xojo the problem were icon files.

Of course I yesterday got another user complaining about the same problem. And even better, this other user has a problem with the clone + compact that my app does and he also has an error -47. I still need to check where exactly the error occurs.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
What fun are reproducible bugs? No, never seen the journal file not being deleted. I'll make the user a version with better exception handling and report back.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Комментарий
There are no comments made yet.
Ivan Smahin Ответ принят
Yes, if you find out journal file after db close, it is a reason to suspect that something went wrong (but it could be no problem).
I have no idea why journal is not deleted by XOJO's file.Delete call. It seems it is specific to XOJO. Can you reproduce it?
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
I always thought that journal files should be deleted when the app is closed normally. My app does a warning when the journal file is found and needs to be checked. How can I tell if the database was terminated normally?

I'll add some code for the exception handling.

But I still don't see why the journal file is deleted when the database is closed but not deleted when the app is quit.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Комментарий
There are no comments made yet.
Ivan Smahin Ответ принят

catch err as VException
if err.ErrorNumber = 394507 then
'just ignore
end if
end try


Actually you suppress all errors, so journal might be "valid" and required to restore db on the next db open.
Комментарий
There are no comments made yet.
Ivan Smahin Ответ принят
Back to your question - "2018-10-23, 19:48:57 MainWindow.CloseDB 0" means that deletion (JournalFile.Delete) was ok, but file is not deleted actually - right?
Комментарий
There are no comments made yet.
Ivan Smahin Ответ принят
But why should you bother about journal existence at all?

There are few scenarios, when journal may exist but be "invalid" (it could be some permission issues for example). Invalid means not damaged, but no valid to be restored from (db is ok, journal will be just reused).
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories