Single Account wiped? Forwardingloop and Horde

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
RockNLol
New user
New user
Posts: 6
Joined: 2017-11-06 12:55

Single Account wiped? Forwardingloop and Horde

Post by RockNLol » 2019-02-19 22:47

hi,
today I had to create a mail-forwarding for a user, who is on holiday. What I did not notice, is that the forwarding recipient has the same rule permanently in the other direction creating an infinite loop of forwarding. This resulted in every received mail appearing three times, before an error was thrown by hmail. Unfortunatley we are also in the process of installing horde with activesync. Some odd combination of this forwarding loop and Horde logging in to the account for the first time and reading everything deleted almost every single e-mail of this one account. only a handful of e-mails from today and yesterday are still present. I checked hmails data folder and the eml-files are still there. Also the accountsize in the hmail admin interface still says 800MB which is too big for the ten-ish mails that are left.
So I guess the DataDirectorySynchronizer is needed to restore these mails. What I read so far it is not possible to limit DataDirectorySynchronizer to a single account, or is it? I also have a mysql dump from yesterday night, as well as the daily data backup if that helps. I don't really want to bother all the other accounts that are working fine. What can I do?

palinka
Senior user
Senior user
Posts: 624
Joined: 2017-09-12 17:57

Re: Single Account wiped? Forwardingloop and Horde

Post by palinka » 2019-02-19 23:00

delete vs expunge? Can you log in from a different imap client to check.

Horde web interface "deletes" by default which is a flag. If those messages are still there, and they probably are, you should be able to undelete them either from horde or a different client. Try thunderbird.

RockNLol
New user
New user
Posts: 6
Joined: 2017-11-06 12:55

Re: Single Account wiped? Forwardingloop and Horde

Post by RockNLol » 2019-02-19 23:54

In thunderbird I discovered, that all the sent e-mails are still there, inbox is still almost empty. It seems all the emls I discovered in the data directory are these sent mails. At least all that I opened were from this account to some different mailbox. But I still can restore all the emls of this folder from last nights backup.

*edit: I still don't know exactly what happened and why they got deleted, but It looks like horde or this forwarding loop did it, since it is the only thing that changed.

palinka
Senior user
Senior user
Posts: 624
Joined: 2017-09-12 17:57

Re: Single Account wiped? Forwardingloop and Horde

Post by palinka » 2019-02-20 01:59

I would get horde working and then go for the backup.

If you're using Jimi's backup script, you can run another backup first, take hmailserver offline, then restore the previous day, then import the new messages from today (drag n drop), then run the data directory synchronization on all accounts. You'll be up a while. Make some coffee.

Or, just import the one bad mailbox and run data directory synchronize on just that one.

First option sucks for you, second one sucks for the user. If it were my mailbox, i wouldn't hesitate to do the first option, but for anyone else... they can make their own coffee.

By the way, I've been using horde a while now and it runs like a top. Activesync is great. I've never experienced anything like what you're talking about. It doesn't sound like anything horde would do because in the end it's just webmail. It doesn't do anything by itself unless you've set up tasks to perform at login. As far as I'm aware, the are no default login tasks. I'm thinking someone pushed something they shouldn't have. There is an:"empty mailbox" button in basic mode. I bet that's the culprit. That's a dangerous one.

If you have logging enabled, you might be able to find out what went wrong.

User avatar
SorenR
Senior user
Senior user
Posts: 3003
Joined: 2006-08-21 15:38
Location: Denmark

Re: Single Account wiped? Forwardingloop and Horde

Post by SorenR » 2019-02-20 04:44

About the matter of the loop...

Ever since version 4.2, hMailServer have a "Rules loop count" in hMailAdmin -> Settings -> Protocols -> SMTP [Advanced] to not allow looping to continue forever.

When first forwarding an email, hMailServer add a header "X-hMailServer-LoopCount" containing the number of times hMailServer have "seen" the message.

So if "Rules loop count" = 5 then hMailServer will allow the email to pass 5 times before stopping it. Thus you will have 5 copies in your INBOX, well actually if you removed the selection in "Keep original message" when setting the forwarding address, you will have NONE.

This is also one of the reasons why hMailServer will store a message for a minimum of 1 minute in queue before passing it on.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

RockNLol
New user
New user
Posts: 6
Joined: 2017-11-06 12:55

Re: Single Account wiped? Forwardingloop and Horde

Post by RockNLol » 2019-02-20 09:27

@Soren, yes that is enabled and set to 3, resulting in three mails as expected. I don't know, if that was the problem.
I have horde runinng on my testserver for a week now and it also runs quite nicely. Yesterday I replicated everything to the actual server and this happened. What exactly is on fault is a mystery.

looking in the logs of hmail, yesterday there were these four following errors:

Code: Select all

"ERROR"	6000	"2019-02-19 17:20:34.449"	"Severity: 3 (Medium), Code: HM5042, Source: File::ReadTextFile, Description: An unknown error occurred while reading a text file from disk."
"ERROR"	6000	"2019-02-19 17:20:34.460"	"Severity: 3 (Medium), Code: HM5136, Source: TCPConnection::AsyncReadCompleted, Description: An error occured while parsing data. Data length: 838, Data: xq57 UID FETCH 1809:2342,[...],3468:3469 (UID FLAGS RFC822.SIZE BODY.PEEK[] INTERNALDATE). Remote IP: <client-ip"
"ERROR"	6000	"2019-02-19 17:20:34.463"	"Severity: 2 (High), Code: HM4208, Source: ExceptionHandler::Run, Description: An error occured while executing 'IOCPQueueWorkerTask', Message: bad allocation"
"ERROR"	6000	"2019-02-19 17:20:34.733"	"Severity: 1 (Critical), Code: HM5519, Source: StackLogger::Log, Description: An error has been detected. A mini dump has been written to C:\Program Files (x86)\hMailServer\Logs\minidump_2019-02-19 172034_{xxxxxxxxxx}.dmp"
the dmp is not really readable by me. Is this a problem with the harddisk the mails are on?

@palinka:
i picked option two, and went to sleep ;) Do you know by any chance why horde creates new sent, trash and so on folders with [1] at the end of the name?

User avatar
mattg
Moderator
Moderator
Posts: 19648
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Single Account wiped? Forwardingloop and Horde

Post by mattg » 2019-02-20 10:24

Ensure that your server anti-virus has the hMailserver data directory excluded
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

RockNLol
New user
New user
Posts: 6
Joined: 2017-11-06 12:55

Re: Single Account wiped? Forwardingloop and Horde

Post by RockNLol » 2019-02-20 10:32

Ok, I did now. Do you think the antivirus doesn't let hmail read some mails?

palinka
Senior user
Senior user
Posts: 624
Joined: 2017-09-12 17:57

Re: Single Account wiped? Forwardingloop and Horde

Post by palinka » 2019-02-20 14:34

RockNLol wrote:
2019-02-20 09:27
@Soren, yes that is enabled and set to 3, resulting in three mails as expected. I don't know, if that was the problem.
I have horde runinng on my testserver for a week now and it also runs quite nicely. Yesterday I replicated everything to the actual server and this happened. What exactly is on fault is a mystery.

looking in the logs of hmail, yesterday there were these four following errors:

Code: Select all

"ERROR"	6000	"2019-02-19 17:20:34.449"	"Severity: 3 (Medium), Code: HM5042, Source: File::ReadTextFile, Description: An unknown error occurred while reading a text file from disk."
"ERROR"	6000	"2019-02-19 17:20:34.460"	"Severity: 3 (Medium), Code: HM5136, Source: TCPConnection::AsyncReadCompleted, Description: An error occured while parsing data. Data length: 838, Data: xq57 UID FETCH 1809:2342,[...],3468:3469 (UID FLAGS RFC822.SIZE BODY.PEEK[] INTERNALDATE). Remote IP: <client-ip"
"ERROR"	6000	"2019-02-19 17:20:34.463"	"Severity: 2 (High), Code: HM4208, Source: ExceptionHandler::Run, Description: An error occured while executing 'IOCPQueueWorkerTask', Message: bad allocation"
"ERROR"	6000	"2019-02-19 17:20:34.733"	"Severity: 1 (Critical), Code: HM5519, Source: StackLogger::Log, Description: An error has been detected. A mini dump has been written to C:\Program Files (x86)\hMailServer\Logs\minidump_2019-02-19 172034_{xxxxxxxxxx}.dmp"
the dmp is not really readable by me. Is this a problem with the harddisk the mails are on?

@palinka:
i picked option two, and went to sleep ;) Do you know by any chance why horde creates new sent, trash and so on folders with [1] at the end of the name?
bad allocation usually indicates a hardware issue.

I don't know why [1] would be appended to imap folder names. I did a quick search on the mailing list archive and couldn't find anything. Are the folders duplicated?

User avatar
mattg
Moderator
Moderator
Posts: 19648
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Single Account wiped? Forwardingloop and Horde

Post by mattg » 2019-02-20 23:39

RockNLol wrote:
2019-02-20 10:32
Ok, I did now. Do you think the antivirus doesn't let hmail read some mails?
Slow access to files often presents as poor performing disk
Antivirus scanning files will slow down access (and make files disappear)
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply