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

How to force mail scanner to stop after timeout #25

Open
vslonska opened this issue Sep 12, 2024 · 7 comments
Open

How to force mail scanner to stop after timeout #25

vslonska opened this issue Sep 12, 2024 · 7 comments
Labels
question Further information is requested

Comments

@vslonska
Copy link

Hello,
I quite often have a problem with the mail scanner, which goes on and on and on... even if the Cron is ok and running well, and the server configured as recommended.
I have to manually stop it and to wait a few minutes for the cron to start it to get it work again.
Capture d’écran du 2024-09-12 22-29-23

I would like to automatically stop it if it doesn't end after some time.
Is it possible ?

Thank you,
Regards,

@garryatbrighton
Copy link

garryatbrighton commented Sep 18, 2024

Go to your database and fire:
delete from vtiger_ossmails_logs where status = 1 limit 1;

I have set it in cron:
*/5 * * * * /usr/bin/mysql -u[user] -p[password]< /var/www/html/mysql-commands/clearmailscanner.sql > /var/www/html/cache/logs/cronmysql.log 2>&1

clearmailscanner.sql:
USE mydatabase;
delete from vtiger_ossmails_logs where status = 1 limit 1;

@rskrzypczak
Copy link
Contributor

@garryatbrighton This will not solve the problem in any way.

The problem in such cases is always the issue of parsing the email.
The YF system cannot handle it for some reason.
The problem is usually the attachments, headers or the email content itself.
So I recommend activating the application logs and see what exactly is the problem.

By the way, if you are using version 6.5 or lower, I recommend updating to 7.0.x, because the entire mechanism of the email scanner has been thoroughly rebuilt and it will most likely reduce the number of errors in this area.

@rskrzypczak rskrzypczak added the question Further information is requested label Sep 19, 2024
@vslonska
Copy link
Author

Thank you for your answers.
I use the last version of Yetiforce.
Which logs should I activate?

I also activated the option in config/main.php to stop Cron after 1 hour if the task is not completed but it doesn't stop the email scanner.

Thank you,
Regards,

@rskrzypczak
Copy link
Contributor

rskrzypczak commented Sep 20, 2024

Which logs should I activate?

config/Debug.php

public static $LOG_TO_FILE = true;
public static $LOG_LEVELS = ['error','warning'];
public static $LOG_TRACE_LEVEL = 9;

public static $DEBUG_CRON = true;

Logs will be registered in the following file: cache/logs/system.log and cache/logs/cron/*

@vslonska
Copy link
Author

Hello,
I have in te log file :

2024-09-23 22:13:10.323 [error][] - Mail Scanner - Account: 1, folder: INBOX, UID: 581, message: ERR_ILLEGAL_FIELD_VALUE||subject||OSSMailView||




Échec de certaines corrections pour Indexation des pages problèmes
 du site domain.fr

 - 0 app/Mail/Scanner.php:152  >>  App\Log->error('Mail Scanner - Account: 1, folder: INBOX, UID: 581, message: ERR_ILLEGAL_FIELD_VALUE||subject||OSSMailView||




Échec de certaines corrections pour Indexation des pages problèmes
 du site domain.fr
')
 - 1 modules/OSSMailScanner/crons/Scann.php:46  >>  App\Mail\Scanner->run()
 - 2 cron.php:100  >>  OSSMailScanner_Scann_Cron->process()
2024-09-23 22:13:01.2318 [info][[application]] -
$_SESSION = ['last_activity'=>1727122381.261789]
_HEADERS = []

Do you have any idea ?
Thanks,

@rskrzypczak
Copy link
Contributor

It seems that the subject of the email is the source of the problem here. It may contain HTML syntax or some other unacceptable characters. Also check if you have uft8mb4 or uft8mb3 database encoding. If you can, please provide the subject of the email.

@vslonska
Copy link
Author

Hello,
Thanks for the answer.

It's a message from Google Search Console. In the headers I have :

subject Échec de certaines corrections pour Indexation des pages problèmes du site mydomain.fr

fromGoogle Search Console Team <sc-noreply@google.com>

If I open the system.log file with a local text editor I see (with an encoding problem) :
�chec de certaines corrections pour Indexation des pages problèmes

I don't see any encoding problem in the subject of the email in the inbox (Rouncube in Yetiforce or in the original mailbox of the provider).

The encoding of the database is correct I think :
Screenshot 2024-09-24 at 09-28-13 Configuration serveur

I can send you the problematic email if you want.

I also have another error :

2024-09-23 23:59:19.2802 [error][[App\Fields\File]] - Error during file validation: mj_logo_with_text_color.svg | Size: 4362
 App\Exceptions\DangerousFile: ERR_FILE_ILLEGAL_FORMAT in app/Fields/File.php:1279
Stack trace:
#0 app/Fields/File.php(444): App\Fields\File->validateFormat()
#1 app/Fields/File.php(474): App\Fields\File->validate()
#2 app/Mail/Message/Imap.php(558): App\Fields\File->validateAndSecure()
#3 app/Mail/Message/Imap.php(528): App\Mail\Message\Imap->getFileFromImage()
#4 app/Mail/Message/Imap.php(378): App\Mail\Message\Imap->parseBody()
#5 app/Mail/Message/Imap.php(430): App\Mail\Message\Imap->getBody()
#6 app/Mail/ScannerAction/CreatedMail.php(68): App\Mail\Message\Imap->hasAttachments()
#7 modules/OSSMail/views/MailActionBar.php(50): App\Mail\ScannerAction\CreatedMail->process()
#8 include/main/WebUI.php(161): OSSMail_MailActionBar_View->process()
#9 index.php(26): Vtiger_WebUI->process()
#10 public_html/index.php(13): require('...')
#11 {main}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants