Last Comment Bug 707329 - Folder panel has no content. JSON.parse: unexpected end of data Source File: chrome://messenger/content/folderPane.js
: Folder panel has no content. JSON.parse: unexpected end of data Source File: ...
Status: VERIFIED FIXED
[gs][datalossy]
: regression
Product: Thunderbird
Classification: Client Software
Component: Folder and Message Lists (show other bugs)
: 9 Branch
: All All
: -- normal with 3 votes (vote)
: Thunderbird 12.0
Assigned To: Mark Banner (:standard8, limited time in Dec)
:
:
Mentors:
http://getsatisfaction.com/mozilla_me...
: 720474 720616 720958 721842 (view as bug list)
Depends on:
Blocks: 717225
  Show dependency treegraph
 
Reported: 2011-12-02 14:47 PST by Kami
Modified: 2012-11-02 06:32 PDT (History)
26 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
+
fixed
+
fixed


Attachments
Bad, binary content of folderTree.json (1.06 KB, text/plain)
2011-12-06 05:01 PST, Kami
no flags Details
Another bad folderTree.json (449 bytes, application/octet-stream)
2011-12-11 22:41 PST, Kami
no flags Details
faulty folderTree.json from WinXP (947 bytes, application/octet-stream)
2012-01-04 11:29 PST, Fred Wenzel [:wenzel]
no flags Details
Handle the error (1.75 KB, patch)
2012-01-10 07:54 PST, Mark Banner (:standard8, limited time in Dec)
mozilla: review+
bwinton: ui‑review+
Details | Diff | Splinter Review
folderTree.json after Linux system crash (512 bytes, text/plain)
2012-01-10 09:29 PST, Roland Tanglao :rolandtanglao
no flags Details
Branch fix (823 bytes, patch)
2012-01-10 13:16 PST, Mark Banner (:standard8, limited time in Dec)
mozilla: review+
Details | Diff | Splinter Review
Updated trunk patch (1.70 KB, patch)
2012-01-11 01:56 PST, Mark Banner (:standard8, limited time in Dec)
standard8: review+
standard8: ui‑review+
Details | Diff | Splinter Review
Branch fix v2 (805 bytes, patch)
2012-01-11 01:58 PST, Mark Banner (:standard8, limited time in Dec)
standard8: review+
standard8: approval‑comm‑aurora+
Details | Diff | Splinter Review

Description Kami 2011-12-02 14:47:52 PST
User Agent: Mozilla/5.0 (Ubuntu; X11; Linux x86_64; rv:10.0a2) Gecko/20111202 Firefox/10.0a2
Build ID: 20111202052423

Steps to reproduce:

After (updating and) starting Beta version of Thunderbird 9


Actual results:

The folder panel is empty, nothing appear at that place.
I tried to resize the window of TB, move the slide between folder panel and message panel. It is working but I haven't got any content in folder panel.
I tried also the safe-mode and disabling extension.

I have working client, I can write a new letter, receive mails, etc. But I cant open addo-ons tab.

The screenshot:
http://kepfeltoltes.hu/111202/thunderbird9problem_www.kepfeltoltes.hu_.png

I have Ubuntu 11.10 and Thunderbird 9 Beta from thunderbird-next ppa


Expected results:

Folder should be viewable on folder panel
Comment 1 David :Bienvenu 2011-12-02 15:27:05 PST
If you bring up tools, error console, are there any errors?
Comment 2 Kami 2011-12-04 23:29:53 PST
I cannot reproduce on my home machine.

On the problematic machine:

Error: JSON.parse: unexpected character
Source File: chrome://messenger/content/folderPane.js
Line: 196

"
        this._persistOpenMap = JSON.parse(data);
"
Comment 3 David :Bienvenu 2011-12-05 07:11:06 PST
Hmm, sounds like your open map was corrupted. I though I had a patch that added a try catch around this, but was convinced that we couldn't generate json that we couldn't reparse. In your user profile directory, there's a file called folderTree.json - if you shutdown TB, move that away (don't delete it, since I'm curious what its contents are), and restart, you should see your folder pane again.
Comment 4 Mark Banner (:standard8, limited time in Dec) 2011-12-05 07:28:52 PST
I supported someone on irc that had this issue - his folderPane.js looked like a binary file. Not quite sure what could cause this, but I think a try catch would help.
Comment 5 Kami 2011-12-06 04:57:46 PST
Hi!

I renamed the old file, and yes it was a binary like file. I upload it because I cannot see any personal information in it. The bad file is nearly 3x bigger then the newly created: 369 vs 1088.
Comment 6 Kami 2011-12-06 05:01:48 PST
Created attachment 579283 [details]
Bad, binary content of folderTree.json
Comment 7 Kami 2011-12-11 22:40:25 PST
Happened again. Maybe it is connected to improper shutdown of Thunderbird.
Comment 8 Kami 2011-12-11 22:41:34 PST
Created attachment 580831 [details]
Another bad folderTree.json
Comment 9 Fred Wenzel [:wenzel] 2012-01-04 11:29:49 PST
Created attachment 585822 [details]
faulty folderTree.json from WinXP

Changing to All/All, because I was able to confirm this problem on Thunderbird 9.0.1 on Windows XP. Renaming the file and restarting Thunderbird fixed the problem for now.

The file contains random binary gibberish, it seems.
Comment 10 :aceman 2012-01-06 16:04:00 PST
Some of the getsatisfaction.com reports mention this happening after OS crash.
Comment 11 Roland Tanglao :rolandtanglao 2012-01-09 15:32:54 PST
An ex-colleague of mine just saw this happen on Linux (Ubuntu 11.04) after a crash. removing folderTree.json fixed it for him too
Comment 12 :aceman 2012-01-10 00:36:58 PST
What exactly did crash for him? Thunderbird? Does he have a crash ID? Or the whole OS?
Comment 13 Ludovic Hirlimann [:Usul] 2012-01-10 01:53:02 PST
(In reply to Roland Tanglao :rolandtanglao from comment #11)
> An ex-colleague of mine just saw this happen on Linux (Ubuntu 11.04) after a
> crash. removing folderTree.json fixed it for him too

And did your friend saved the file ?
Comment 14 Mark Banner (:standard8, limited time in Dec) 2012-01-10 07:54:32 PST
Created attachment 587321 [details] [diff] [review]
Handle the error

In the absence of understanding why folderTree.json is getting corrupt (apart from a crash causing it for some reason we don't yet understand), a try/catch seems the best thing to keep users going.

This will also log the failure to the error console, so that the user knows why it happens.

I'll do a hard-coded en-US version for the branches, which shouldn't really matter as it is only going to the error console.
Comment 15 Roland Tanglao :rolandtanglao 2012-01-10 09:29:50 PST
Created attachment 587350 [details]
folderTree.json after Linux system crash

(In reply to Ludovic Hirlimann [:Usul] from comment #13)
> (In reply to Roland Tanglao :rolandtanglao from comment #11)
> > An ex-colleague of mine just saw this happen on Linux (Ubuntu 11.04) after a
> > crash. removing folderTree.json fixed it for him too
> 
> And did your friend saved the file ?

It was a System Crash, not a Thunderbird crash. Here's his saved folderTree.json. Hope it helps.
Comment 16 David :Bienvenu 2012-01-10 09:35:08 PST
Comment on attachment 587321 [details] [diff] [review]
Handle the error

generally, the error on the console is just going to be "SyntaxError: JSON.parse: unexpected character" which is of limited value.
Comment 17 :aceman 2012-01-10 11:04:44 PST
Will this help the users in any way to recover from the situation? Or will it be just debugging hint for us if they post that message?
Comment 18 David :Bienvenu 2012-01-10 11:31:10 PST
(In reply to :aceman from comment #17)
> Will this help the users in any way to recover from the situation? Or will
> it be just debugging hint for us if they post that message?

The folder pane will appear, but you will lose the collapsed/expanded state of your folders. So, a vast improvement.
Comment 19 :aceman 2012-01-10 11:42:30 PST
So if the file is corrupt, thanks to ignoring this error TB will regenerate the folder view to some initial (uncollapsed) state? Thanks, that would be great.
Comment 20 David :Bienvenu 2012-01-10 11:43:33 PST
(In reply to :aceman from comment #19)
> So if the file is corrupt, thanks to ignoring this error TB will regenerate
> the folder view to some initial (uncollapsed) state? Thanks, that would be
> great.

yes, though the state is (mostly) collapsed, not uncollapsed.
Comment 21 Mark Banner (:standard8, limited time in Dec) 2012-01-10 13:16:27 PST
Created attachment 587445 [details] [diff] [review]
Branch fix

Non-string affecting version for branches.
Comment 22 Blake Winton (:bwinton) (:☕️) 2012-01-10 13:44:49 PST
Comment on attachment 587321 [details] [diff] [review]
Handle the error

I think I'ld prefer it to be:
failedToReadFile=Failed to read file: %1$S reason: %2$S
so that we can use the message in other places.  ui-r=me with that change.
Comment 23 Mark Banner (:standard8, limited time in Dec) 2012-01-11 01:56:38 PST
Created attachment 587628 [details] [diff] [review]
Updated trunk patch

Addresses the comment from the ui-review.
Comment 24 Mark Banner (:standard8, limited time in Dec) 2012-01-11 01:58:41 PST
Created attachment 587630 [details] [diff] [review]
Branch fix v2

With revised wording.
Comment 25 Mark Banner (:standard8, limited time in Dec) 2012-01-11 02:00:19 PST
Checked into trunk: http://hg.mozilla.org/comm-central/rev/2216e845c307

I'll file a follow-up bug later for seeing if we can handle the corruption in a better way, e.g. hardening the file writing or backup routines.
Comment 26 Mark Banner (:standard8, limited time in Dec) 2012-01-11 06:06:07 PST
Checked into branches:

http://hg.mozilla.org/releases/comm-aurora/rev/67482f1a5317
http://hg.mozilla.org/releases/comm-beta/rev/381fce935899
Comment 27 WADA 2012-01-15 18:11:21 PST
Checked with Tb12.0a1 2012/01/14 build
> Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120114 Thunderbird/12.0a1

(1) Corrupt folderTree.json manually, restart Tb => error message at Error Console
(1-1) x {}
> Timestamp: 2012/01/16 10:40:30
> Error: Failed to read file: folderTree.json reason: SyntaxError: JSON.parse: unexpected character
> Source File: chrome://messenger/content/folderPane.js Line: 200
(1-2) {
> Timestamp: 2012/01/16 10:42:19
> Error: Failed to read file: folderTree.json reason: SyntaxError: JSON.parse: end of data while reading object contents
> Source File: chrome://messenger/content/folderPane.js Line: 200
(1-3) {} x
> Timestamp: 2012/01/16 10:43:24
> Error: Failed to read file: folderTree.json reason: SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data
> Source File: chrome://messenger/content/folderPane.js Line: 200
(2) Folder pane is re-initialized(all is collapsed).
(3) Click account, folder, terminate Tb. Following was saved in fileTree.json.
> {"all":["mailbox://x@x.x.x","mailbox://x@x.x.x/Inbox","mailbox://nobody@Local%20Folders"]}

=> Verified
Comment 28 Mark Banner (:standard8, limited time in Dec) 2012-01-24 06:23:07 PST
*** Bug 720616 has been marked as a duplicate of this bug. ***
Comment 29 :aceman 2012-01-25 07:36:53 PST
*** Bug 720958 has been marked as a duplicate of this bug. ***
Comment 30 David 2012-01-25 14:32:34 PST
*** Bug 720474 has been marked as a duplicate of this bug. ***
Comment 31 Wayne Mery (:wsmwk, NI for questions) 2012-01-27 13:28:22 PST
*** Bug 721842 has been marked as a duplicate of this bug. ***
Comment 32 phil harris 2012-01-30 08:02:12 PST
(My first foray in here, so apologies in advance)
I have experienced this bug - my json file was full of nulls, and the error log clearly showed a file reading error. (ref 'i_cannot_see_any_folders_help')

1. This was a trivial bug that was injected by poor developer testing - the 'json.parse' routine should automatically test for correct file format. The commentry above does not make it clear if this now happens, as the fault is not restricted to just this instance.
2. The result of the bug was very 'novice' - there should have been a 'fail-safe' result not a catastrophic loss of functinality. Have other places where this routine is used been checked ? The commentry above does not make this clear.
3. This should have surfaced during testing shouldnt it ? Doesnt anyone deliberately interfere with all the data files ?
4. If this was spotted TWO MONTHS ago, why isnt it a Known Issue ? (It produces a catastrophic loss of functionality !)

regards to all fellow professionals
phil harris
senior software developer
trend control systems
Comment 33 Santiago Solari 2012-02-07 01:50:14 PST
Just had this problem and thought I'd post a note in hope I might shed some light on what causes the file corruption... This happened on my Windows 7 laptop that I hibernated (instead of shutting down) a couple of days in a row. At one point I noticed that I had a couple of hanging Visual Studio processes that took a lot of memory and decided to reboot. I don't know in which state Thunderbird was at that moment, but it showed no signs of trouble. The shutdown process stuck and I had to kill it using the power button. When I booted it again, Thunderbird still worked but Skype had lost its settings. I shut down the laptop normally afterwards but the next time I started it and ran Thunderbird, the left pane was empty. It also re-downloaded all messages, even the ones I already had in the mailbox, from one POP3 server (I have set all accounts to leave messages on the server for 7 days) but this seemed to happen only for one of the two accounts I have. At that point my folderTree.json file had 345 bytes of NULLs. Then I installed Thunderbird 10 (the previous version was 9.0.1) and the pane reappeared but folderTree.json was left as it was. Only after I removed the file did it regenerate.
Comment 34 strasserpablo 2012-02-12 05:21:27 PST
I had the same problem with a folderTree.json with 0 byte.
This happened during the night when an program was runing with extensif output with thunderbird on.
It happened that i had no more disc space.
After creating more disque space. And a reboot of thunderbird. I had this problem.
The only way to correct it was to move the empty file out.
Safe mode or disable addon doesn't serve.

This problem was part my fault for having a disque with no free space. But i think that a recovery mechanism or a message saying wich file to move can be usefull.
Comment 35 Siddharth Agarwal [:sid0] (inactive) 2012-02-12 06:47:24 PST
All bets are off with Mozilla code if your disk is full, really...
Comment 36 Thomas 2012-03-09 17:43:08 PST
I had the same problem, but unfortunately my folderTree.json does not get recreated after moving it away. When closing thunerbird the following messages popup in the error console:

https://bugzilla.mozilla.org/show_bug.cgi?id=707329

	Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFileOutputStream.init]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///usr/lib/thunderbird-3.1.19/modules/sessionStoreManager.js :: ssm_saveStateObject :: line 171"  data: no]


	Error: Components is not defined
	Source File: chrome://messenger/content/folderPane.js
	Line: 1873

	Error: gFolderDisplay is not defined
	Source File: chrome://messenger/content/msgMail3PaneWindow.js
	Line: 96

	Error: this._tree is null
	Source File: chrome://messenger/content/folderPane.js
	Line: 1895

Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19
Comment 37 Sebastian Hengst [:aryx][:archaeopteryx] (needinfo on intermittent or backout) 2012-03-10 13:17:27 PST
This bug is about Thunderbird 9.
You write that the errors are printed while closing Thunderbird. The workaround has to be applied while Thunderbird doesn't run. Then I also get the folderTree.json rebuilt with Thunderbird 3.1.19. But maybe something else is broken in the profile.

You can get support for Thunderbird at http://getsatisfaction.com/mozilla_messaging/
Comment 38 Götz Lohmann 2012-10-31 12:05:58 PDT
Happening now on Windows 7 when upgrading to version 16.0.2

If I reinstall an older version (e.g. 12.0.1) the folders pane get back. This happen without any previous crash but the folderTree.json only include the empty brackets {} (2 bytes). I can still see in the file menu (File>Get new Messages) my folder structure. Does it maybe only occur with a certain amount of accounts in the list as I have up to 23. Or it is an issue with my virus scanner (BitrDefender) but I even tryed to disable all plugins. I also tryed to delete the json file but to no avail.

Anyway in the console I got a couple of errors and warnings:
1-3. Warning: XUL box for _moz_generated_content_before element contained an inline #text child, forcing all its children to be wrapped in a block. (toolbar.xml)
4. Error: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.setBoolPref] (specialTabs.js)
Timestamp: 31.10.2012 19:56:44
5. Error: TypeError: gStatusBar is null (tabmail.xml)
Timestamp: 31.10.2012 19:56:45
6. Warning: XUL box for _moz_generated_content_before element contained an inline #text child, forcing all its children to be wrapped in a block. (messenger.xul)
Comment 39 Wayne Mery (:wsmwk, NI for questions) 2012-11-02 06:32:17 PDT
(In reply to Götz Lohmann from comment #38)
> Happening now on Windows 7 when upgrading to version 16.0.2
> 

see bug 807848

Note You need to log in before you can comment on or make changes to this bug.