Imap error spamming logs

Howdy,

Ok so quick question regarding SuiteCRM 8.4

It keeps continuously filling my suite log with:

Tue Oct 10 14:58:07 2023 [53772][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 14:58:07 2023 [53772][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 14:58:07 2023 [53772][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 14:59:07 2023 [53783][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 14:59:07 2023 [53783][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 14:59:07 2023 [53783][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:00:07 2023 [53792][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:00:07 2023 [53792][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:00:07 2023 [53792][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:01:07 2023 [53812][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:01:07 2023 [53812][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:01:07 2023 [53812][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:02:07 2023 [53821][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:02:07 2023 [53821][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:02:07 2023 [53821][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:03:07 2023 [53832][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:03:07 2023 [53832][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:03:07 2023 [53832][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:04:07 2023 [53841][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:04:07 2023 [53841][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:04:07 2023 [53841][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:05:07 2023 [53850][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:05:07 2023 [53850][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:05:07 2023 [53850][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:06:07 2023 [53861][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:06:07 2023 [53861][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:06:07 2023 [53861][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:07:07 2023 [53871][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:07:07 2023 [53871][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:07:07 2023 [53871][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:08:07 2023 [53881][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:08:07 2023 [53881][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:08:07 2023 [53881][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:09:07 2023 [53892][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:09:07 2023 [53892][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:09:07 2023 [53892][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:10:07 2023 [53901][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:10:07 2023 [53901][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:10:07 2023 [53901][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:11:07 2023 [53911][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:11:07 2023 [53911][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:11:07 2023 [53911][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:12:07 2023 [53921][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:12:07 2023 [53921][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:12:07 2023 [53921][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:13:07 2023 [53932][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:13:07 2023 [53932][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:13:07 2023 [53932][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:14:07 2023 [53943][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:14:07 2023 [53943][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:14:07 2023 [53943][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:15:07 2023 [53953][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:15:07 2023 [53953][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:15:07 2023 [53953][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:16:07 2023 [53962][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:16:07 2023 [53962][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:16:07 2023 [53962][1][FATAL] An Imap error detected: "IMAP search error"
Tue Oct 10 15:17:07 2023 [53976][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:17:07 2023 [53976][1][FATAL] ImapHandler trying to use a non valid resource stream.
Tue Oct 10 15:17:07 2023 [53976][1][FATAL] An Imap error detected: "IMAP search error"

It adds 3 lines every minute. that’s 4320 new entries every day.
There are so many errors and issues labeled SuiteCRM I have no idea what the correct place to report this is.

Is it here? Github? Somewhere else?
Are there any reports already on this?

Look for it on Gituhb, please, and report there, if it’s reported yet.

It is probably related to your email configs, perhaps deleting a misconfigured account will make it go away.

I have three inbound email accounts configured.
The Sales Group user account (email sales@)
A bounce email account for campaign bounces
My email account

If I “edit” an account and Test Connection Settings I get a “Connection completed successfully” and two lines on the logs:

[10-Oct-2023 16:51:47 Europe/Lisbon] PHP Notice:  Undefined index: externalOauthConnectionName in /var/www/develop/public_html/sales/public/legacy/modules/InboundEmail/Popup.php on line 127
[10-Oct-2023 16:51:47 Europe/Lisbon] PHP Notice:  Undefined index: externalOauthConnectionId in /var/www/develop/public_html/sales/public/legacy/modules/InboundEmail/Popup.php on line 130

About inbound email accounts
Sales

  • Server Configuration:
    basic auth
    IMAP at Port 993
    Use SSL
    Connection String empty
    Monitored folders:
    INBOX
    Trash
    Sent
  • Outbound Config
    Allow users to send using from: yes
    from name: sales
    from address: sales email address
    reply to name: sales
    reply-to address: sales email address
  • Auto Reply Config all empty as of yet
  • Group Configuration
    Import emails automatically: checked
    move messages to trash after import: checked
  • Case Configuration
    Create case from email: not checked

Personal

  • Server Configuration:
    basic auth
    IMAP at Port 993
    Use SSL
    Connection String empty
    Monitored folders:
    INBOX
    Trash
    Sent
  • Outbound Config
    Allow users to send using from: yes
    from name: yours truly
    from address: email address
    reply to name: same
    reply-to address: same email address

Bounce

  • Server Configuration:
    basic auth
    IMAP at Port 993
    Use SSL
    Connection String empty
    Monitored folders:
    INBOX
    Trash
    Sent

I don’t believe it is a misconfigured account. Also the configs are fairly simple hard to miss…
I’ll try and get a moment to check that then, thanks

Ok, just narrowed it down to what account is having issues. It’s the Group account, sales.

However, looking at the mail server logs, I see nothing bad, only a connect and what it seems a clean exit:

10/10/2023, 17:04:06	info	imap-login: Login: user=<sales@domain.tld>, method=PLAIN,
rip=red.act.ed.ip, lip=172.22.1.250, mpid=301935, TLS, TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
10/10/2023, 17:04:07	info	imap(sales@domain.tld)<301935><Pbg+214HFZd0y66c>: Disconnected:
Connection closed (CLOSE finished 0.117 secs ago) in=48 out=869 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0

There’s known bug that the account edit screen throws away the “ssl/tls” settings, it always reverts to “none” after saving, even after a successful test email. I have a recent fix for that somewhere on Github.

If it’s not that, then I don’t know, email can get incredibly tricky with SuiteCRM…

1 Like

Yeah I was aware of that issue, I first installed 8.3 it was present, but double-checked the database to see how the fields were saved and was all OK
In the meanwhile I read that issue had been resolved and fix released in 8.4, ran upgrade and confirm resolution.

1 Like

Ok so the only issues I found using the keywords were these:

which are different from mine. I also noticed (had missed this before really) that I had php 7.4 in use, changed to 8.2 and the errors increased.
Reported it all here

Did you ever get resolution to this?

The bug report at

is still open with no resolution - but at least it is acknowledged as a bug.

I am seeing the same issue with my log file filling with IMAP error logs.

I am on SuiteCRM 7.14.3 on PHP v8.2

For me, I get 3 errors every 30 minutes

Sat May 18 13:30:01 2024 [33880][1][FATAL] ImapHandler trying to use a non valid resource stream.
Sat May 18 13:30:01 2024 [33880][1][FATAL] ImapHandler trying to use a non valid resource stream.
Sat May 18 13:30:01 2024 [33880][1][FATAL] An Imap error detected: "IMAP search error"

And when I receive an Inbound email to the bounced account, I get a series of this error only
Sat May 18 13:41:48 2024 [16104][1][FATAL] ImapHandler trying to use a non valid resource stream.

I can send and receive emails so it LOOKS like all is working but I am not sure what (if anything) to do about the errors piling up in the logs

I think the algorithm of these class methods ( getStream() and setStream() ) is incorrect.

It’s doing the wrong thing, it checks if it’s a valid stream, logs a warning when it’s not a valid stream, and in all cases, it returns the (maybe invalid) stream.

Instead, it should check if it’s a valid stream, if not, set the stream to null, then return the stream. It’d then be up to the caller to detect the stream’s null, and act accordingly.

I think you are on to something, but what I cannot figure out is why everything is working but I keep getting my error log filling with errors.

I thought I read somewhere (but cannot now find it) that the issue was not the initial act of making the IMAP connection (which worked and explains why the system does as intended) but was instead a redundant (loop?) second attempt at the IMAP connection which failed because the connection was already made and that is what generated the errrors.

But if that is true, then where is this error in the code and how to fix it?

This issue has been present on numerous systems for quite a while and is still unresolved. Given that a CRM uses emails a LOT, having a code issue in the email controls seems like something that would have received priority attention, but here it sits.

Are you still seeing the errors piling up in your logs?

Hi guys

I am also plagued with this in my logs, running 7.14.3
Would love to see a fix for this.

Cheers
T

I have the same issue with
Version 7.14.4
Sugar Version 6.5.25 (Build 344)

Also Email Import fails totally see here:

Will this be fixed or is there a workarround?