Skip to content
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

Sometimes unable to login #1640

Closed
realsimix opened this issue Jun 20, 2024 · 16 comments
Closed

Sometimes unable to login #1640

realsimix opened this issue Jun 20, 2024 · 16 comments
Labels
external Issue is outside our code workaround

Comments

@realsimix
Copy link

Describe the bug
It's quite strange that I can sometimes not login as mail user and sometimes it works.

To Reproduce
Steps to reproduce the behavior:

  1. Enter username and password and login

Expected behavior
User should be logged in.

Please complete the following information:

  • Browser: Firefox 115.11.0esr
  • IMAP daemon: cyrus-imapd-3.4.1
  • PHP version: 8.0.30
  • SnappyMail Version: 2.36.3
  • Mode: standalone
  • OS: AlmaLinux 9

Debug/logging information
I see these error in PHP log:
[20-Jun-2024 12:11:46 UTC] PHP Warning: Undefined array key 0 in /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/Status.php on line 122
[20-Jun-2024 12:11:46 UTC] PHP Warning: Undefined array key 9 in /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/Status.php on line 165
[20-Jun-2024 13:10:50 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/ResponseParser.php on line 199

Find attached a slightly shortened log file. I hope this is useful to find what is causing the issue.
log-2024-06-20-info.txt

Thanks!

@realsimix
Copy link
Author

Looking at the detailed log it seems that actually the IMAP login succeeds but the error happens while fetching the folder list.

@the-djmaze
Copy link
Owner

That is weird.

PHP[WARNING]: Undefined array key 0 /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/Status.php [line:122, code:2]

That should return NULL
But then:

SERVICE[WARNING]: base64_encode(): Argument #1 ($string) must be of type string, array given
#0 /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/Status.php(122): base64_encode()

And php says it's an array. i wonder how that is possible at all.

For now i just made a workaround.

@realsimix
Copy link
Author

I still have often issues logging in with a lot of this:

[23-Jun-2024 15:44:58 UTC] PHP Warning: Undefined array key 9 in /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/Status.php on line 169

Is this another place with the same problem?
Thanks!

@realsimix
Copy link
Author

realsimix commented Jun 24, 2024

When it's not working I often see this error (but the server is not busy at all):

[24-Jun-2024 05:58:56 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /usr/share/snappymail/2.36.3/app/libraries/MailSo/Imap/Traits/ResponseParser.php on line 207

@the-djmaze
Copy link
Owner

FolderStatus and FolderList could potentially produce your issue.
Yet, your log is missing those commands.
Like:

> TAG3 LIST "" "*" RETURN (SUBSCRIBED SPECIAL-USE STATUS (MESSAGES UNSEEN UIDNEXT UIDVALIDITY HIGHESTMODSEQ SIZE))\r\n
< * LIST () "." virtual\r\n
< * NO Mailbox doesn't exist: virtual\r\n
< * LIST (\UnMarked) "." ToDo\r\n
< * STATUS ToDo (MESSAGES 1 UIDNEXT 2 UIDVALIDITY 1588756711 UNSEEN 0 HIGHESTMODSEQ 5 SIZE 2454)\r\n

the-djmaze pushed a commit that referenced this issue Jun 24, 2024
@realsimix
Copy link
Author

realsimix commented Jun 24, 2024

I didn't want to post the full log here, can I send it somehow by private message/email?

@realsimix
Copy link
Author

With the new patch I get a number of messages like below:

[24-Jun-2024 12:29:58 UTC] INBOX.Ecommerce.Delta invalid MAILBOXID value

These messages are random, the folders work fine.

@the-djmaze the-djmaze added the external Issue is outside our code label Jun 24, 2024
@the-djmaze
Copy link
Owner

the-djmaze commented Jun 24, 2024

Your response has:

* STATUS INBOX (... MAILBOXID ((ü×GrU) ...)\r\n

https://datatracker.ietf.org/doc/html/rfc8474#section-7

objectid = 1*255(ALPHA / DIGIT / "_" / "-")
status-att-val =/ "MAILBOXID" SP "(" objectid ")"

It seems your cyrus-imapd is at fault and crashes the SnappyMail parser.

Go to Admin -> Domains -> Domain and disable the OBJECTID capability for your server.

@the-djmaze
Copy link
Owner

the-djmaze commented Jun 24, 2024

As a note: due to the bug in Cyrus the response is completely broken:

    [ResponseList] => Array
        (
            [0] => *
            [1] => STATUS
            [2] => INBOX
            [3] => Array
                (
                    [0] => MESSAGES
                    [1] => 109
                    [2] => UIDNEXT
                    [3] => 113
                    [4] => UIDVALIDITY
                    [5] => 1202996492
                    [6] => MAILBOXID
                    [7] => Array
                        (
                            [0] => Array
                                (
                                    [0] => ü×GrU
                                )

                            [1] => UNSEEN
                            [2] => 0
                            [3] => SIZE
                            [4] => 4944775
                            [5] => HIGHESTMODSEQ
                            [6] => 13
                        )

                )

        )

While it should have been:

    [ResponseList] => Array
        (
            [0] => *
            [1] => STATUS
            [2] => INBOX
            [3] => Array
                (
                    [0] => MESSAGES
                    [1] => 109
                    [2] => UIDNEXT
                    [3] => 113
                    [4] => UIDVALIDITY
                    [5] => 1202996492
                    [6] => MAILBOXID
                    [7] => Array
                        (
                            [0] => a-zA-Z0-9_
                        )

                    [8] => UNSEEN
                    [9] => 0
                    [10] => SIZE
                    [11] => 4944775
                    [12] => HIGHESTMODSEQ
                    [13] => 13
                )

@realsimix
Copy link
Author

I don't have OBJECTID in the list there, is that correct?

@the-djmaze
Copy link
Owner

I don't have OBJECTID in the list there, is that correct?

Read https://github.com/the-djmaze/snappymail/wiki/IMAP-capabilities

@realsimix
Copy link
Author

Thanks, got it and now the errors are gone.

So, this is a bug then in my version of cyrus-imapd? It's the version of RHEL9 and if I know exactly what is wrong maybe I can report the bug there.

@the-djmaze
Copy link
Owner

the-djmaze commented Jun 24, 2024

@realsimix
Copy link
Author

Thanks a lot for reporting the bug to cyrusimap!

@realsimix
Copy link
Author

Any chance you could make a release with this change?

Thanks!

@the-djmaze
Copy link
Owner

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issue is outside our code workaround
Projects
None yet
Development

No branches or pull requests

2 participants