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
[CW-1588] Email & attachments gets fetched again and again but no conversation is created #5081
Comments
I can reproduce the bug on your cloud hosted platform. I created an account on the Chatwoot cloud platform and created an email inbox. I did not use IMAP this time. I just used the forwarding address provided by the email inbox. I sent a test email with just text which created a new conversation and worked as it should. Then I sent the email that could not get fetched to the forwarding address and it did not create a conversation. Maybe you can check the logs on your side? Account ID: 73633 I could also forward the problem email to some support email of yours, so you can resend it yourself. Maybe this helps to find out why the mail gets not converted to a conversation. |
I can confirm this as well.
|
More background for the devs for debugging. This mail attachment contains:
If you need more information about the E-Mail let me know. ps / edit: |
Could this be the culprit? chatwoot/app/models/message.rb Line 35 in 7ad5dda
|
Sorry for the direct ping @vishnu-narayanan but this issue did not get any (real) attention yet. |
I checked my problem email again to add some additional information. It contains 31 attachments. All of them are either .jpg or .png. All filenames are properly slugified though, no weird special characters. One file was larger than the others with a size of 1.6 MB and 1663 × 2157 pixels. |
Bump. Does no one else see the implication here? |
We stopped our testing of chatwoot completely after we noticed this bug. We would love to use it for our company, but we are afraid of user requests and support cases not being fetched and going unnoticed. Using the paid hosted platform does not help either, because it is happening there too. But using it as a DDoS attack is another valid concern. The monitoring @BrutalBirdie provided, shows how one simple email can completely swamp the server storage because of the short fetching interval. Imagine sending hundreds of these emails to the same server. Maybe it makes sense to hash the email when the fetching starts and save this hash as pending fetch. If the fetching is a success, the saved hash can be deleted again. But if the fetching fails at some point, it will not get fetched again or it will only get fetched a pre-defined amount before this hash gets flagged as a problem email. |
It's rather shocking that this did not get any attention so far. |
@sojan-official Any chance this will be addressed in the next release? We have hit this issue again and it does pose a large risk to our self-hosted instance. |
Any update on this? Do you want the original email to investigate? @sojan-official |
Any update on this? |
Describe the bug
A specific email gets fetched by an email inbox via IMAP but no conversation will be created. The worker will create the attachments in storage. The next time the worker fetches that specific email, all attachments will be created again and again.
Steps To Reproduce
Not sure whats wrong with the specific email. It is a newsletter email with lots of html and lots of images with a size of around 2.5Mb. Should I upload the raw email source code?
Expected behavior
Email should gets fetched via IMAP and a conversation should be created. Attachments should not get stored again and again every minute.
Screenshots
The email got received at 9:30. Disk usage increases. The email got resend multiple times to check whats wrong. At 11:30 the resent copies got deleted from the mail server. The original was kept but it got not fetched again. I guess because it fetches only the last n emails? After that disk usage gets normal again.
Server logs
I reproduced the bug by resending the email. The output is always the same:
Fetching starts
Jul 21 11:19:02 ubuntu-fra1-01 chatwoot-worker.1[729]: I, [2022-07-21T11:19:02.102482 #729] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e] Performing Inboxes::FetchImapEmailsJob (Job ID: f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e) from Sidekiq(low) enqueued at 2022-07-21T11:19:02Z with arguments: #<GlobalID:0x000056023e56a770 @uri=#<URI::GID gid://chatwoot/Channel::Email/4>>
Then attachments gets stored. I ommited most of them as they look the same.
Jul 21 11:19:05 ubuntu-fra1-01 chatwoot-worker.1[729]: I, [2022-07-21T11:19:05.058117 #729] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e] Disk Storage (1.1ms) Uploaded file to key: cwox63adqlkk9cntlf4uyefi771l (checksum: os3A30UZKHMt7k8ohl7HOg==)
Jul 21 11:19:05 ubuntu-fra1-01 chatwoot-worker.1[729]: I, [2022-07-21T11:19:05.064246 #729] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e] Disk Storage (1.2ms) Uploaded file to key: a75rnsfpwko0cswmm6lf8c05jsw3 (checksum: sYFhRFkrO1fWZcO0i+Ys9A==)
Then there is an error
Jul 21 11:19:05 ubuntu-fra1-01 chatwoot-worker.1[729]: E, [2022-07-21T11:19:05.088996 #729] ERROR -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e] wrong number of arguments (given 0, expected 1..2)
And its done
Jul 21 11:19:05 ubuntu-fra1-01 chatwoot-worker.1[729]: I, [2022-07-21T11:19:05.097905 #729] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e] Performed Inboxes::FetchImapEmailsJob (Job ID: f493e8da-6730-4a4d-b5d9-4ed0f5cdb85e) from Sidekiq(low) in 2995.1ms
Jul 21 11:19:05 ubuntu-fra1-01 chatwoot-worker.1[729]: 2022-07-21T11:19:05.098Z pid=729 tid=2ebd class=Inboxes::FetchImapEmailsJob jid=cf65b98fd059b7ee3feac2b7 elapsed=3.009 INFO: done
Environment
Self hosted Linux VM installation on DigitalOcean. Installed with the installer according to the documentation.
4 vCPUs / 8 GB Memory / 80 GB Disk / FRA1 - Ubuntu 20.04 (LTS) x64
CW-1588
The text was updated successfully, but these errors were encountered: