'Unexpected end of file' when loading the user language model

Bug #1278599 reported by marmuta on 2014-02-10
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Onboard
High
Unassigned

Bug Description

Terminal output of Bug #1277255 contains this snippet:

2014-02-08 11:34:10,906:ERROR:Onboard.WPEngine: Bad file format, unexpected end of file in '/home/ch2lah/.local/share/onboard/models/user.lm'
2014-02-08 11:34:10,907:ERROR:Onboard.WPEngine: Saving word suggestions disabled to prevent further data loss.

Learned word suggestions won't persist between Onboard sessions.

marmuta (marmuta) wrote :

That file may contain personal information, so I can't ask you to put it on the Internet. I'll work on a script to diagnose loading failures instead.

You can try this as a workaround, while still keeping the broken file around:
$ killall onboard
$ mv ~/.local/share/onboard/models/user.lm{,.broken-2010-02-10}
$ cp ~/.local/share/onboard/models/user.lm{.bak,}
$ onboard

This reverts the word suggestions to the last known-good state and the error should no longer appear.

Lee Hyde (anubeon) wrote :

Done and done.

Now Onboard's immediate terminal output only shows the following uncritical messages.:

>> onboard
>>
>> (onboard:19706): Gtk-WARNING **: Unknown key gtk-decoration-layout in /usr/share/themes/elementary/gtk-3.0/settings.ini

I'll keep it on for a while and report back if I see any suspect output later on.

marmuta (marmuta) wrote :

Thanks, that looks better.

I've hacked up a diagnosis script and pushed it to trunk. When you can, please run it with the broken file. You can get that script either with the source project as usual:

$ bzr branch lp:onboard
$ cd onboard
$ Onboard/pypredict/tools/checkmodels ~/.local/share/onboard/models/user.lm.broken-2010-02-10

or simply download it from here to wherever you want:
https://bazaar.launchpad.net/~onboard/onboard/trunk/view/head:/Onboard/pypredict/tools/checkmodels
$ ./checkmodels ~/.local/share/onboard/models/user.lm.broken-2010-02-10

Hopefully that gives us a hint about what happened.

Lee Hyde (anubeon) wrote :

Thanks for all the hard work and the swift response.

> I've hacked up a diagnosis script and pushed it to trunk. When you can, please run it with the broken file.

Output for the script was as follows.

   $ ./checkmodels ~/.local/share/onboard/models/user.lm.broken-2010-02-10
   Traceback (most recent call last):
     File "./checkmodels", line 26, in <module>
       import pypredict
   ImportError: No module named 'pypredict'

I hope that's of use to you, means nowt to me. :-)

marmuta (marmuta) wrote :

Yeah, I messed up. It should work from anywhere now (as long you have Onboard installed). Would you try again please?

Lee Hyde (anubeon) wrote :

Done…

   $ ./checkmodels ~/.local/share/onboard/models/user.lm.broken-2010-02-10

   (checkmodels:510): Gtk-WARNING **: Unknown key gtk-decoration-layout in /usr/share/themes/elementary/gtk-3.0/settings.ini
   checking '/home/ch2lah/.local/share/onboard/models/user.lm.broken-2010-02-10'
   File size 0; Number of lines 0
   Errors found:
     1: empty file

I'm afraid it doesn't look /very/ informative. :-|

marmuta (marmuta) wrote :

The output looks good this time, the file is just empty. FYI, if you run ./checkmodels without parameters it should find the models currently used by Onboard and print some more information.

I'm still stuck now, I have no good idea how Onboard could possibly save an empty file. Perhaps there was something from the outside, full disk, unclean shutdown, filesystem bug (ext4?)?

In any case, I think the loading error should maybe not stay silent and there should perhaps be an offer to revert to the backup language model, same thing we did manually before.

Lee Hyde (anubeon) wrote :

> FYI, if you run ./checkmodels without parameters it should find the models currently used by Onboard and print some more information

   $ ./checkmodels

   (checkmodels:24337): Gtk-WARNING **: Unknown key gtk-decoration-layout in /usr/share/themes/elementary/gtk-3.0/settings.ini
   checking '/home/ch2lah/.local/share/onboard/models/user.lm'
   File size 50981; Number of lines 1809
   Number of 1-grams: declared 543, found 543, OK
   Number of 2-grams: declared 669, found 669, OK
   Number of 3-grams: declared 584, found 584, OK
   No errors.

All looks well, I presume?

> I'm still stuck now, I have no good idea how Onboard could possibly save an empty file.
> Perhaps there was something from the outside, full disk, unclean shutdown, filesystem bug (ext4?)?

My home partition has ample space (as do root and storage partitions), although I did have some trouble with Thunderbird filling up my home partition several months ago. Perhaps the file was saved then? I've experienced a few unclean shutdowns over the months, so that's a possibility. Also, my home and root partitions *are* formatted ext4.

> In any case, I think the loading error should maybe not stay silent and there should perhaps be an offer to revert to the backup language model, same thing we did manually before

Agreed!

Thank you for all your work on this, It's much appreciated. :-)

marmuta (marmuta) wrote :

You're welcome.

> All looks well, I presume?
Yes, no errors this time.

I've added that check to trunk and it asks to revert to the backup too. If you want to test it (be sure to keep another backup of user.lm), do:
- exit onboard (killall onboard is fine)
- open ~/.local/share/models/user.lm in an editor and delete anything or everything.
- start Onboard and a dialog should pop up.

This doesn't solve the ultimate cause, but we will at least hear when it happens again.

Changed in onboard:
status: New → Fix Committed
importance: Undecided → High
Francesco Fumanti (frafu) wrote :

This bug should be fixed with the 1.0.0 release. If you still encounter problems, please feel free to reopen this bug or file a new one.

Changed in onboard:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers