-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mail is not displayed, JS running ready #560
Comments
When debugging the javascript in Chrome, I can see where it fails. In js.storage.js an array is being stored as an item in the "messages" set. Apparently this is the basic mail info with the headers, like title, cc, reply-to etc. This is converted via JSON.stringify and that one throws an uncaught exception: Uncaught (in promise) RangeError: Invalid string length Unfortunately I have no clue which string that may be and where the actual source is to add a try/catch block around it for further investigation. Also the callstack is not very informative either. So if anyone could either tell me where to find the sources in question, the point in the mail, where this is triggered or even a 'better' JS debugger I would offer to investigate further - especially as it seems that I'm the only one being able to reproduce this so far. |
I found a pattern! Messages that are displayed properly have a low message ID, about 0 to 300. The failing messages have HUGE IDs, like 627173617 or 627182862 which kind of feels like an overflow issue. Fun thing is that these apparently worked just fine in Nextcloud 11. |
Wow, good finding.
Well, maybe your UIDs were just lower back then 😉 |
I don't know if it depends on the same issue but the behaviour is similar. Steps to reproduceUpgrade from Nextcloud 11 to 12 Expected behaviourThe selected mail is shown Actual behaviourThe list of folders is shown, the mail titles of the current folder are shown, the selected mail is not shown, just the roller while one core stays busy. But i can show mails from the mailboxes from the local dovecot IMAP mailboxes. General server configurationOperating system: Linux J6868 2.6.32-5-xen-686 #1 SMP Sun Jul 13 02:47:03 UTC 2014 i686 Web server: Apache/2.4.6 (CentOS) Database: mysqld 10.1.28-MariaDB PHP version: PHP 7.1.10 (cli) Nextcloud configurationNextcloud version: 12.0.3 - 12.0.3.3 Updated from an older Nextcloud/ownCloud or fresh install: 11.0.x Where did you install Nextcloud from: tar Are you using encryption: no Client configurationBrowser: Opera 48.0.2685.39 & Firefox 56.0 LogsNextcloud log
Browser log core.js?v=5e62c204c9d0686558507be74b7a52c7-19:7 JQMIGRATE: Migrate is installed, version 1.4.0 |
I guess that could be the issue. We don't catch that. |
@christophKi If you have the chance, check the MessageId. In Firefox you would open the web console with F12 or CTRL-SHIFT-k and watch the list of resources getting loaded, not sure how to see that on Opera. If the browser gets stuck on a resource like: https:///index.php/apps/mail/accounts/2/folders/AB1CD2EF/messages/123456789 then it's probably the same issue. Most interesting is the last number, which is the message ID. If that is ridiculously large you're seeing the same issue - or at least the same thing triggers your issue. By the way, Opera shows the error at the same place as Chrome: js.storage.js:152 Uncaught (in promise) RangeError: Invalid string length at JSON.stringify () at Object._set (js.storage.js:152) [...] it's just packing the information differently, so it's most likely the same issue. |
Yes :) it's the same. Thx This is from the Firefox log with a large message ID where it gets stuck: From an other mailbox where i can show the messages, with shorter ID: Best regards Ah, as much as I know, opera used the same engine as chrome. |
I believe that the message ID is broken, or at least the way it is interpreted. Stepping through the code in question I noticed that the app generates an array with MessageID entries to store the messages for the folder. When trying to add the message to the cache, the localStorage gets exhausted by trying to add an empty array with over 600.000.000 indices. Looking into the data, the mail body is there though, so it's not like the server returned random data. I have not yet found the place where the MessageID comes from. It also does not seem to correlate with the number of messages in the folder. What I saw so far: 106 Messages in Folder - last message ID 95, 295 - 280, 192 - 627182270, 408 - 627198350 |
I found a workaround. Since the Message ID is just used as a hash token for the cache and the numbers are consecutive, I decided to just truncate them down to 1024. This lets me read my messages again. However this will mess up the cache on folders with more than 1024 messages - which is why I'm reluctant to call it a real fix. The proper way would be to align the MessageID with the actual number of messages in the folder. On the other hand I feel like this is 'good enough' as I'm not sure how many people will actually have folders with more than 1024 messages. getMessagePath: function(account, folder, messageId) { @christophKi I'm not sure how much control you have over your installation, otherwise I would send you the build.js to replace your local version so you can at least give it a spin. That should be enough to have my patch - it's also built against the current release (0.7.3), not the head as that doesn't work for me either. You could also just edit mail/js/build/build.js, find the getMessagePath() function and edit it there. Should be line 8576. Tested that by incrementing the modulo to 2028 |
Still happens with 0.7.7... modulo workaround still works. |
One thought on this: to have a clean solution I believe it would make most sense to get the lowest MessageID of the current folder and take that as base offset value. However that would mean that getMessagePath() needs an easy way to retrieve that number. Also I'm not sure if 'getting the lowest MessageID' is a feasible task at all. Right now I'm using a Modulo of '10240' as a workaround which has not yet shown any issues and has no impact on performance. Otherwise I'm curious if me and @christophKi really the only ones seeing this problem. |
Jup, today I updated to nextcloud 12.0.5 and mail 0.7.9. Sill the same problem. greetings |
Steps to reproduce
Upgrade from Nextcloud 11 to 12
Upgrade mail plugin to 0.7.3
Try to check mails
Expected behaviour
The list of folders is shown, the mail titles of the current folder are shown, the selected mail is shown
Actual behaviour
The list of folders is shown, the mail titles of the current folder are shown, the selected mail is not shown, just the roller while one core stays busy. This blocks the whole app on Firefox. On Chrome you can still change folders and on some the mails are displayed just fine. I was not able to find a true pattern here. It has apparently nothing to do with number of mails in the folder, mail formatting (html/text/mixed) or sender. The Chrome javascript console however claims some cache error.
General server configuration
Operating system: Linux J6868 2.6.32-5-xen-686 #1 SMP Sun Jul 13 02:47:03 UTC 2014 i686
Web server: nginx/1.6.2 (fpm-fcgi)
Database: mysql 5.5.57
PHP version: 5.6.31-1~dotdeb+7.1
PHP-modules loaded
Nextcloud configuration
Nextcloud version: 12.0.3 - 12.0.3.3
Updated from an older Nextcloud/ownCloud or fresh install: 11.0.x
Where did you install Nextcloud from: web-installer
Are you using external storage, if yes which one: files_external is disabled
Are you using encryption: no
Are you using an external user-backend, if yes which one: n/a
Disabled apps
Content of config/config.php
Client configuration
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/61.0.3163.79 Chrome/61.0.3163.79 Safari/537.36
Operating system: Ubuntu 16.04
Logs
Nextcloud log (data/nextcloud.log)
``` Info mail Updating draft <627204655> in account <1> 2017-10-05T09:14:55+0200 Info mail Updating draft <627204654> in account <1> 2017-10-05T09:14:50+0200 Info mail Updating draft <627204653> in account <1> 2017-10-05T09:14:38+0200 Info mail Updating draft <627204652> in account <1> 2017-10-05T09:13:43+0200 Info mail Updating draft <627204651> in account <1> 2017-10-05T09:13:05+0200 Info mail Updating draft <627204650> in account <1> 2017-10-05T09:12:53+0200 Info mail Updating draft <627204649> in account <1> 2017-10-05T09:12:49+0200 Info mail Updating draft <627204648> in account <1> 2017-10-05T09:11:16+0200 Info mail Updating draft <627204647> in account <1> 2017-10-05T09:11:11+0200 Info mail Updating draft <627204646> in account <1> 2017-10-05T09:10:49+0200 Info mail Updating draft <627204645> in account <1> 2017-10-05T09:10:42+0200 Info mail Updating draft <627204644> in account <1> 2017-10-05T09:10:10+0200 Info mail Updating draft <627204643> in account <1> 2017-10-05T09:08:52+0200 Info mail Updating draft <627204642> in account <1> 2017-10-05T09:07:38+0200 Info mail Updating draft <627204641> in account <1> 2017-10-05T09:07:19+0200 Info mail Updating draft <627204640> in account <1> 2017-10-05T09:06:21+0200 Info mail Updating draft <627204639> in account <1> 2017-10-05T09:05:59+0200 Info mail Updating draft <627204638> in account <1> 2017-10-05T09:05:57+0200 ```Browser log
``` JQMIGRATE: Migrate is installed, version 1.4.0 init.js:25 Starting Mail … cache.js:47 initializing cache… js.storage.js:152 Uncaught (in promise) RangeError: Invalid string length at JSON.stringify () at Object._set (js.storage.js:152) at Object._callMethod (js.storage.js:438) at Object.set (js.storage.js:461) at Object.addMessage (cache.js:108) at messagecontroller.js:87 at DevTools failed to parse SourceMap: https://cloud.foxbow.de/core/vendor/purify.min.js.map ```Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: