After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644772 - Cannot open program: file locked; crash on "open anyway"
Cannot open program: file locked; crash on "open anyway"
Status: RESOLVED DUPLICATE of bug 647945
Product: GnuCash
Classification: Other
Component: General
2.4.x
Other Windows
: Normal critical
: ---
Assigned To: Christian Stimming
Geert Janssens
Depends on:
Blocks:
 
 
Reported: 2011-03-14 22:30 UTC by michael.tennant
Modified: 2018-06-29 22:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Trace file (409.65 KB, text/plain)
2011-03-21 11:57 UTC, michael.tennant
Details
Trace file after crash (220.85 KB, application/x-zip-compressed)
2011-05-11 20:17 UTC, michael.tennant
Details
File as requested (4.33 KB, text/plain)
2011-05-21 14:28 UTC, michael.tennant
Details

Description michael.tennant 2011-03-14 22:30:59 UTC
On opening program, message is displayed as follows:

GnuCash could not obtain the lock for file://G:\Data\gnucash\budget.gnucash where G:\Data\gnucash\buget.gnucash is the name of the file.

A new file can be opened, and I now know that a saved backup can be opened, but what stops the "real" file opening?  Has it become corrupt for some reason?

I also found that I could not save over the above file (using a backup) but got the same message about inability to obtai lock for the file.
Comment 1 Christian Stimming 2011-03-15 08:19:14 UTC
What happens if you click the button "Open Anyway" in that question window?

Also, that question window should contain a several sentence-long description of why this could have happened. What part of that is unclear to you?
Comment 2 michael.tennant 2011-03-16 17:37:34 UTC
"That database may be in use by another user, in which case you should not open it. What would you like to do?"
Open anyway? Create new file? Quit?
 
Obviously, no other user is using the database!  If I click "Open anyway" the program closes.  "Create new file" is fine, as is "quit".  I CAN open a backup file (though I have lost data, of course).  If I go to the folder above and try to open the file budget.gnucash with a double click, the same thing happens.

I am gradually getting back to where I was before this problem, but I now propose always to save TWICE with two file names, hoping to outwit this bug (if it is a bug).
Comment 3 Christian Stimming 2011-03-16 19:23:30 UTC
Oh, clicking "Open anyway" should, well, open anyway. If it doesn't but instead the program closes, we have a bug here. We need a couple of questions to track this down:

- Can you check the content of the trace file, http://wiki.gnucash.org/wiki/Tracefile

- Is you G: drive somewhat unusual, such as a FAT filesystem or a write-protected USB stick or a SMB windows network share or something like that?

- Do you see a file budget.gnucash.LOCK in the same folder as the gnucash file if this error occurs? If you remove that file before starting gnucash, is the error gone?

- Did you leave any report windows open in gnucash when you closed gnucash the last time?
Comment 4 michael.tennant 2011-03-17 19:39:30 UTC
- G: drive is a normal partition, formatted NTFS.

- I see a file with LCK (not LOCK).  If I move it away (say, to the desktop)then click to open the "budget" file, the program crashes.  A new budget.gnucash.LCK file is created in the gnucash folder.

- I may well have left report windows open when I closed gnucash.  I am a relatively new user and was not aware that this was not to be done!

When I follow the link to http://wiki.gnucash.org/wiki/Tracefile
then locate the TRACE file, I find:

*   WARN <qof.engine> [guid_init()] only got 2130 bytes.
The identifiers might not be very random.
*   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process (No such file or directory)
*   WARN <Gtk> Could not find the icon 'gtk-fullscreen'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases
*   CRIT <gnc.gui> gnc_tree_model_budget_get_iter_for_budget: assertion `GNC_BUDGET(bgt)' failed
 
for 13/03/2011 at 23:45, which is about the time the program was last closed with the "budget" file loaded.
Many other trace files are present, presumably one for each time the program is run.
Mike Tennant
Comment 5 Geert Janssens 2011-03-18 19:07:06 UTC
(In reply to comment #4)
> - G: drive is a normal partition, formatted NTFS.
> 
Ok, that rules out all kinds of issues that could happen on network drives.

> - I see a file with LCK (not LOCK).  If I move it away (say, to the
> desktop)then click to open the "budget" file, the program crashes.  A new
> budget.gnucash.LCK file is created in the gnucash folder.
> 
The question to remove the .LCK file is mostly relevant to network problems. Your test confirms that there is no problem with the file locking mechanism related to your G drive.

> - I may well have left report windows open when I closed gnucash.  I am a
> relatively new user and was not aware that this was not to be done!
> 
It's not really a matter of "not to be done". It should be ok to leave reports open. If you left a report open and that leads to a crash, it means there is a bug in GnuCash that should be fixed. 

> When I follow the link to http://wiki.gnucash.org/wiki/Tracefile
> then locate the TRACE file, I find:
> 
> *   WARN <qof.engine> [guid_init()] only got 2130 bytes.
> The identifiers might not be very random.
> *   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process
> (No such file or directory)
> *   WARN <Gtk> Could not find the icon 'gtk-fullscreen'. The 'hicolor' theme
> was not found either, perhaps you need to install it.
> You can get a copy from:
>     http://icon-theme.freedesktop.org/releases
> *   CRIT <gnc.gui> gnc_tree_model_budget_get_iter_for_budget: assertion
> `GNC_BUDGET(bgt)' failed
> 
> for 13/03/2011 at 23:45, which is about the time the program was last closed
> with the "budget" file loaded.
> Many other trace files are present, presumably one for each time the program is
> run.
Yes, each program run creates one trace file on Windows.

The trace file as it is only gives a small hint to what the problem could be. It suggests a problem related to a budget option net set properly. From the information so far it's hard to determine what goes wrong.

I also tried to replicate this crash on my test system, but I can't. I'd like to know exactly which tabs were open when you last successfully used the file.

Could you try to run gnucash from the command prompt as follows:
* start > run... > cmd.exe
* cd "C:\Program Files\GnuCash\bin"
* gnucash --log "gnc=debug" G:\Data\gnucash\buget.gnucash

This assumes of course that you haven't renamed or moved the file that causes the crash. When it crashes, please attach the newly created trace file. It should be much bigger now and hold more details.

Thanks.
Comment 6 michael.tennant 2011-03-18 20:14:02 UTC
As requested, I ran the program from a command prompt.  First change: this Windows message:
The file file://C:\Users\Michael\.gnucash\data\log could not be found. <close>

On clicking close, the file budget.gnucash attempted to open, then message "gnucash has stopped working" and the usual "Windows is searching for a solution..."

Thw new trace file:
*   WARN <qof.engine> [guid_init()] only got 2133 bytes.
The identifiers might not be very random.
*   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process (No such file or directory)
*   WARN <gnc.core-utils> create new file C:\Users\Michael\.gnucash\data\log
*   WARN <Gtk> Could not find the icon 'gtk-fullscreen'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

Don't know if this helps any!

Mike
Comment 7 michael.tennant 2011-03-18 20:20:44 UTC
One more thing.  I think this might well be the trace file that was produced last week when all went wrong!

*   WARN <qof.engine> [guid_init()] only got 2130 bytes.
The identifiers might not be very random.
*   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process (No such file or directory)
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
*   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)' failed
*   WARN <qof> qof_book_set_dirty_cb: Already existing callback 00F47AD0, will be overwritten by 00F47AD0
Comment 8 Geert Janssens 2011-03-19 09:57:30 UTC
(In reply to comment #6)
> As requested, I ran the program from a command prompt.  First change: this
> Windows message:
> The file file://C:\Users\Michael\.gnucash\data\log could not be found. <close>
> 
> On clicking close, the file budget.gnucash attempted to open, then message
> "gnucash has stopped working" and the usual "Windows is searching for a
> solution..."
> 
> Thw new trace file:
> *   WARN <qof.engine> [guid_init()] only got 2133 bytes.
> The identifiers might not be very random.
> *   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process
> (No such file or directory)
> *   WARN <gnc.core-utils> create new file C:\Users\Michael\.gnucash\data\log
> *   WARN <Gtk> Could not find the icon 'gtk-fullscreen'. The 'hicolor' theme
> was not found either, perhaps you need to install it.
> You can get a copy from:
>     http://icon-theme.freedesktop.org/releases
> 
> Don't know if this helps any!
> 
> Mike

Hmm, this doesn't make much sense. Are you sure you typed the commands exactly as proposed ? Because for some reason gnucash tries to open a file called "log", which obviously fails and there is no debug information at all in the trace file.
Note that there is NO whitespace between "--" and "log".

Can you double check this ?
Comment 9 Geert Janssens 2011-03-19 09:59:57 UTC
(In reply to comment #7)
> One more thing.  I think this might well be the trace file that was produced
> last week when all went wrong!
> 
> *   WARN <qof.engine> [guid_init()] only got 2130 bytes.
> The identifiers might not be very random.
> *   WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process
> (No such file or directory)
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <GLib-GObject> invalid unclassed pointer in cast to `GObject'
> *   CRIT <GLib-GObject> g_object_notify: assertion `G_IS_OBJECT (object)'
> failed
> *   WARN <qof> qof_book_set_dirty_cb: Already existing callback 00F47AD0, will
> be overwritten by 00F47AD0

Thanks for adding this information. Unfortunately it doesn't give a clue at all about what could have gone wrong. A trace file with additional debug information might be more insightful.
Comment 10 Geert Janssens 2011-03-19 10:01:33 UTC
And just for completeness: what version of Windows are you using ? Vista or 7, 32 or 64 bit ?
Comment 11 michael.tennant 2011-03-21 11:57:01 UTC
Created attachment 183930 [details]
Trace file

I hope this trace file is what you wanted to see.
Comment 12 michael.tennant 2011-03-21 11:57:47 UTC
I use Win 7 64 bit
Comment 13 Geert Janssens 2011-04-06 16:58:42 UTC
Michael, it seems to me that the trace file is from a GnuCash run that didn't crash. Is that possible ? There are no errors at all in this trace file.
Comment 14 Akhil Laddha 2011-05-10 06:51:45 UTC
michael.tennant, any response for comment#13 ?
Comment 15 michael.tennant 2011-05-10 18:47:29 UTC
(In reply to comment #13)
> Michael, it seems to me that the trace file is from a GnuCash run that didn't
> crash. Is that possible ? There are no errors at all in this trace file.

No, it didn't crash.  It hasn't crashed since I re-enetered data and started afresh.  Can I just try to open the original file that DID crash?
Comment 16 Geert Janssens 2011-05-11 07:32:58 UTC
Yes, opening the original file that did crash should give more information in the trace file.

You can use the command line recipe as I proposed in comment 5, but replace the file name with the name of the file that did crash.
Comment 17 michael.tennant 2011-05-11 20:17:22 UTC
Created attachment 187662 [details]
Trace file after crash
Comment 18 Geert Janssens 2011-05-21 08:16:14 UTC
Ok, just to be sure: from the trace file I read you are trying to open G:\Data\gnucash\budget.gnucash
And that causes GnuCash to crash. Is that still correct ?

If so, can you then attach the following file to this bug, please :
C:\Users\Michael\.gnucash\books\budget.gnucash.gcm

This file doesn't contain any sensitive data, only a list of which windows and tabs were open the last time budget.gnucash was successfully closed. It will help me determine which report is causing the crash.
Comment 19 michael.tennant 2011-05-21 14:28:54 UTC
Created attachment 188298 [details]
File as requested
Comment 20 Geert Janssens 2011-05-21 16:07:33 UTC
Great, thanks! I can now reproduce the problem, at least in the 2.4 series. The crash doesn't happen anymore on the development branch.

In your specific case the problem is caused by this Budget Barchart tab that was left open:
[Page 17]
PageType=GncPluginPageReport
PageName=Budget Barchart
SchemeOptions=(let ((options (gnc:report-template-new-options/report-guid "415cd38d39054d9e9c4040455290c2b1" "Budget Barchart"))) (let ((option (gnc:lookup-option options "General" "Budget"))) ((lambda (option) (if option ((gnc:option-setter option) (gnc-budget-lookup #f (gnc-get-current-book))))) option)) (gnc:restore-report-by-guid 1 "415cd38d39054d9e9c4040455290c2b1" "Budget Barchart" options))

Specifically the part "(gnc-budget-lookup #f ..."

For some reason gnc-bugdet-lookup doesn't like a value of "#f" (meaning "false") as its first parameter.

This wrong value can get there following these steps:
- create a budget and keep its tab open
- open a budget report for this budget
- switch back to the open budget tab and delete the budget
- restart gnucash
=> crash

The curious thing is that this crash doesn't happen on the development branch. It behaves differently in two ways:
- if you open a file for which the books file has "(gnc-budget-lookup #f ...", it just opens the file with no problem.
- if you run all the steps that lead to the crash in 2.4.x on trunk, you will end up with "(gnc-budget-lookup "000000000000000" ..." in the books file instead.

Looking through the changes on the development branch I think it's commit r20570 (which fixes bug 647945) that is what fixes this crash as well.
It is backported to the 2.4 series and should appear in the next stable release, 2.4.6 which is expected one of the coming weeks.

I'll keep the report open for now, so we can revisit this once 2.4.6 is released.

Can you keep the crashing file around until then, please ?
Comment 21 michael.tennant 2011-05-21 18:35:16 UTC
No problem.  The file is there, but no longer in use.
Comment 22 Geert Janssens 2011-06-11 14:48:29 UTC
Michael, GnuCash 2.4.6 has been released by now. Can you try to install this version and see if the problem file still crashes with this version ?

Thank you.
Comment 23 michael.tennant 2011-06-13 09:05:47 UTC
Installed as you suggested.  On first running, I got the dreaded "lock" message, but when I clicked "open anyway" it did open the file.  I closed the program and reopened.  This time NO NASTY MESSAGE and straight into the file.  Well done, guys!
Mike
Comment 24 Geert Janssens 2011-06-13 09:46:49 UTC
You're welcome.

I just realized there are two more bug reports that deal with this problem (which is mostly fixed now). I'll mark this one as a duplicate.

*** This bug has been marked as a duplicate of bug 647945 ***
Comment 25 John Ralls 2017-09-24 22:05:09 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 26 John Ralls 2018-06-29 22:54:51 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=644772. Please update any external references or bookmarks.