hMailServer has run out of memory

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
snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

hMailServer has run out of memory

Post by snico » 2014-04-17 09:45

hello,

This is my config :
server: windows 2008r2 / 2x XEON 8 cores / 64go ram / 2xSSD 600go
sql : 2 serveur with sql serveur 2008r2 in clustered width 32go ram
hmailserver : i have the bug with this version : 5.4-B1944 and 5.4.1-B1951
- No spamAssasin / No antivirus
- Cach enable : ttl 3600
- Threading : 10 / 5 / 5 (before i try with bigger value like 50 / 25 / 25)
- Indexing : Enabled
- 30 domains / 1000 accounts / 3 000 000 eml
- SMTP open sessions : between 0 and 10
- POP open sessions : between 0 and 10
- IMAP open sessions : between 1000 ans 1600 ( all users uses imap with thundibird)

The problem :
Everything is ok when the memory is less than 1000mo, the nigth the memory is about 700mo.
In the day the problem started, the memory increases up to 1600mb, and then we have a lot error.

the problem occurs every day, especially in the morning when users open Thunderbird


Today in the error logs :

Code: Select all

"APPLICATION"	3148	"2014-04-17 09:16:44.945"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"APPLICATION"	3148	"2014-04-17 09:16:44.945"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"APPLICATION"	3148	"2014-04-17 09:16:44.945"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"APPLICATION"	3148	"2014-04-17 09:16:44.945"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"ERROR"	3148	"2014-04-17 09:16:44.961"	"Severity: 3 (Medium), Code: HM5042, Source: File::ReadTextFile, Description: An unknown error occurred while reading a text file from disk."
"ERROR"	3148	"2014-04-17 09:16:44.961"	"Severity: 1 (Critical), Code: HM5062, Source: IMAPFetch::_ReportCriticalError, Description: ERROR HM10001 - IMAP FETCH: Error when loading MIME message. - D:\HMSDATA\*********.com\*******.*******\AD\{AD9C2E83-BB72-4038-A3AD-D45F78E3274B}.eml"
"DEBUG"	5256	"2014-04-17 09:16:44.976"	"Reading messages from database."
"APPLICATION"	3148	"2014-04-17 09:16:44.976"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"APPLICATION"	3148	"2014-04-17 09:16:44.976"	"OutOfMemoryHandler - hMailServer has run out of memory, clearing caches."
"ERROR"	3148	"2014-04-17 09:16:44.976"	"Severity: 3 (Medium), Code: HM5136, Source: TCPConnection::HandleRead, Description: An error occured while parsing data. Data length: 45, Data: 7 UID fetch 604 (UID RFC822.SIZE BODY.PEEK[]). Remote IP: 90.85.124.111"
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

Re: hMailServer has run out of memory

Post by snico » 2014-04-17 11:13

I think that hmailserver not support use more than 1.7gb of ram!!

other software have the same problem : https://www.google.fr/search?q=windows+limit+1.7gb
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer has run out of memory

Post by Bill48105 » 2014-04-17 20:28

There are well known limitations of 32bit programs like hmailserver. No idea when 64 bit will be made available. Generally hmailserver uses very little memory. Mine is normally no more than 120MB after months. But I have very few IMAP users & IMAP can definitely consume a lot of RAM especially if users have crazy amount of messages in INBOX and/or open very large emails (entire email must be read into memory). That is why I limit who can use IMAP & the size of messages and warn people who have too many in INBOX.

Your hmail logs should give you a hint as to what is going on at the time. You might need to split some users up between multiple servers to avoid it.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

Re: hMailServer has run out of memory

Post by snico » 2014-04-17 20:53

I have resolved the problem!!!!! :D :D :D :D

I modify the hmailserver.exe to set the flag : "App can handle >2gb address space"

you can do this with "CFF Explorer", it's explain in this forum
=> http://www.pso-world.com/forums/showthread.php?t=199993

you can do this with the command "editbin /largeaddressaware hmailserver.exe"
=> http://forums.arcgis.com/threads/53104- ... HEC-GeoRAS

Hmailserver.exe was about 1.9go this afternoon. I wait 1 week, an see if errors occur again.

I think martin should put this flag before releasing the next version of hmailserver.

With this flag hmailserver can handle 4Gb memory, so the problem wil occur again in several year ;-)

Our users need to send large email, so I set the size limit of mail to 40MB. This increases the problem!

In the future there will be only 64bit OS.
I think it would be interesting to do a 64bit version and drop the 32bit version so that martin does not have 2 software to maintain.
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer has run out of memory

Post by Bill48105 » 2014-04-17 21:51

snico wrote:I have resolved the problem!!!!! :D :D :D :D

I modify the hmailserver.exe to set the flag : "App can handle >2gb address space"

you can do this with "CFF Explorer", it's explain in this forum
=> http://www.pso-world.com/forums/showthread.php?t=199993

you can do this with the command "editbin /largeaddressaware hmailserver.exe"
=> http://forums.arcgis.com/threads/53104- ... HEC-GeoRAS

Hmailserver.exe was about 1.9go this afternoon. I wait 1 week, an see if errors occur again.

I think martin should put this flag before releasing the next version of hmailserver.

With this flag hmailserver can handle 4Gb memory, so the problem wil occur again in several year ;-)

Our users need to send large email, so I set the size limit of mail to 40MB. This increases the problem!

In the future there will be only 64bit OS.
I think it would be interesting to do a 64bit version and drop the 32bit version so that martin does not have 2 software to maintain.
Thanks for the info. Interesting that helps & more so that it does not cause problems. You can be the guinea pig. :D
The 64 vs 32 bit thing has been over so many times it's not even funny. Truth is 99.999% of hmail users have no need for 64bit hmail and there are many users who are still on 32bit so not like we could dump them. Obviously the day is nearing where we need to look harder at releasing a 64bit version of hmail as more people run into memory limitations. Let us know how your experiment goes & if you run into any problems. I'll look into what it takes to build that flag into hmail and post a special build.
Thx
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer has run out of memory

Post by Bill48105 » 2014-04-17 21:56

I'll need to check the hmail code to make sure it is safe to use that flag.. Note the warnings:
http://stackoverflow.com/questions/3109 ... ress-aware
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer has run out of memory

Post by Bill48105 » 2014-04-17 21:59

And be sure to read this:
http://stackoverflow.com/questions/2288 ... xecutables
blindly applying the LargeAddressAware flag to your 32bit executable deploys a ticking time bomb!
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

Re: hMailServer has run out of memory

Post by snico » 2014-05-05 10:50

Hello!

After 3 week, it's work very well!

Before april 17 : between 200 and 2000 error each days in logs, and I restart the service regularly!
april 17 : I tweak the hmailserver.exe with the flag LARGEADDRESSAWARE

After april 17 : 0 errors, 0 restart!

Max Working Set Memory : 2.6gb !!!!
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

Bill48105
Developer
Developer
Posts: 6189
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer has run out of memory

Post by Bill48105 » 2014-05-05 18:46

snico wrote:Hello!

After 3 week, it's work very well!

Before april 17 : between 200 and 2000 error each days in logs, and I restart the service regularly!
april 17 : I tweak the hmailserver.exe with the flag LARGEADDRESSAWARE

After april 17 : 0 errors, 0 restart!

Max Working Set Memory : 2.6gb !!!!
That's good news. You sure there were no other issues such as memory corruption? Did you see I posted up a build with the large aware flag set during build?
Thx
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

kaspercat
New user
New user
Posts: 6
Joined: 2014-08-07 18:14

Re: hMailServer has run out of memory

Post by kaspercat » 2014-08-08 18:47

I have been having hundreds of this " OutofMemoryHandler - hMailServer has run out of memory" Error
Any further advise or development on solving this problem or of using this back to enable /Largeadresssaware?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: hMailServer has run out of memory

Post by percepts » 2014-08-08 19:11

are you running Networx on your machine? If so turn it off.

snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

Re: hMailServer has run out of memory

Post by snico » 2014-08-27 15:51

Hello
After four months, it works very well.
before I had hundreds of errors since there were over 1500 imap connection because the memory was over 2Gb

Now that's great! :mrgreen: :mrgreen: :mrgreen: :mrgreen:
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Re: hMailServer has run out of memory

Post by martin » 2014-11-11 12:50

This will be addressed in 5.6.
Martin Knafve
martin@hmailserver.com
https://twitter.com/knafve

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Re: hMailServer has run out of memory

Post by martin » 2014-11-18 19:58

Just an update on this: hMailServer 5.6 will be released a bit earlier than I intended, so the fix for this issue will be included in 5.7 instead.
Martin Knafve
martin@hmailserver.com
https://twitter.com/knafve

snico
New user
New user
Posts: 27
Joined: 2010-01-04 12:18

Re: hMailServer has run out of memory

Post by snico » 2016-03-16 18:59

After 2 years the problem is back and is happening again!!! I think that's because we hit the 3Go limit. I will continue to look into it and will keep you posted.
Nicolas Cavaré
hMailServer 5.4.1 B1951 external MSSQL 2008 r2
Windows 2008 r2 | 2 x Intel Xeon E5-2650v2 | 64 Go DDR3 | 2 x Intel SSD 600go

bcpaul
Normal user
Normal user
Posts: 31
Joined: 2014-07-17 23:32

Re: hMailServer has run out of memory

Post by bcpaul » 2016-06-03 20:06

If your Mac Apple Mail clients have avast anti-virus, it cause MAJOR issues with memory consumption. Hmailserver will run out of memory, and lost emails, etc.
Now this was back in January 2016 that I discovered this. Maybe an Avast update has solved this I don't know.

I have verified 100% that Avast and Apple Mail causes hmailserver to run out of memory causing serious issues with hmailserver. It just takes ONE user with this to cause out of memory errors. Not sure why this is not stickied in the forum. Avira will work fine.

Martin has not fixed the issue that I know of (no new releases). I tried to contact him about it, but no success.

bcpaul
Normal user
Normal user
Posts: 31
Joined: 2014-07-17 23:32

Re: hMailServer has run out of memory

Post by bcpaul » 2016-06-03 20:08

With about 100 users with HEAVY use (many large file attachments), I consistently get ~150-200MB mem usage. With ONE Apple Mail / Avast user It would quickly ramp up over 1GB and start causes issues. These users were on IMAP.

User avatar
Dravion
Senior user
Senior user
Posts: 1414
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: hMailServer has run out of memory

Post by Dravion » 2016-06-03 22:08

I never used hms as a production mailserver, but if a Windows program (like hms) calls an external program as child process, it can harm the parent process in many ways. So your observation makes sense and you need an Avast update or configure Avast as Service.

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

Re: hMailServer has run out of memory

Post by SorenR » 2016-06-03 23:02

Dravion wrote:I never used hms as a production mailserver, but if a Windows program (like hms) calls an external program as child process, it can harm the parent process in many ways. So your observation makes sense and you need an Avast update or configure Avast as Service.
Avast sit between the Server and Client like a Proxy... No matter how well behaved your Client is, if your Proxy is dirty, your communication sucks and ressources are hogged from the server...
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.

tochi
Senior user
Senior user
Posts: 278
Joined: 2015-07-28 22:55

Re: hMailServer has run out of memory

Post by tochi » 2016-06-06 20:48

Dravion wrote:I never used hms as a production mailserver, but if a Windows program (like hms) calls an external program as child process, it can harm the parent process in many ways. So your observation makes sense and you need an Avast update or configure Avast as Service.
I believe he's talking about this post. viewtopic.php?f=7&t=29081&p=183179#p182496
In that case, there's no other process running on hmailserver machine. hmailserver simply could not defend itself well from an ill behaved client.

leshan
New user
New user
Posts: 19
Joined: 2015-04-13 16:39

Re: hMailServer has run out of memory

Post by leshan » 2016-11-29 20:02

martin wrote:This will be addressed in 5.6.
Upgraded to 5.6. Got the same error message as OP recently. Checked windows server 2012 resource monitor memory tab, hmailserver used about 1GB under Commit and 300MB under Working Set.
A reboot of sever seems fixed it for more than 24hours, don't know when will it come back, currently used about 200MB under Commit and Working Set.
Still need to set the flag?
Thanks.

leshan
New user
New user
Posts: 19
Joined: 2015-04-13 16:39

Re: hMailServer has run out of memory

Post by leshan » 2016-11-29 22:57

leshan wrote:
martin wrote:This will be addressed in 5.6.
Upgraded to 5.6. Got the same error message as OP recently. Checked windows server 2012 resource monitor memory tab, hmailserver used about 1GB under Commit and 300MB under Working Set.
A reboot of sever seems fixed it for more than 24hours, don't know when will it come back, currently used about 200MB under Commit and Working Set.
Still need to set the flag?
Thanks.
Just checked with dumpbin /headers command. Looks like my hmailserver.exe doesn't have the lin 'Application can handle large (>2GB) addresses'
Is it safe to run editbin /largeaddressaware hmailserver.exe to set the flag? Any risk? Thanks.

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

Re: hMailServer has run out of memory

Post by mattg » 2016-11-29 23:25

martin wrote:Just an update on this: hMailServer 5.6 will be released a bit earlier than I intended, so the fix for this issue will be included in 5.7 instead.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

leshan
New user
New user
Posts: 19
Joined: 2015-04-13 16:39

Re: hMailServer has run out of memory

Post by leshan » 2016-11-29 23:33

mattg wrote:
martin wrote:Just an update on this: hMailServer 5.6 will be released a bit earlier than I intended, so the fix for this issue will be included in 5.7 instead.
Thank you mattg.
Is it safe to run editbin /largeaddressaware hmailserver.exe to set the flag? Any risk? Thanks.

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

Re: hMailServer has run out of memory

Post by mattg » 2016-11-30 01:20

There is always risks

I've not tried that, but then neither have I had need to.
That solution seems to have worked for others, butthen there is an alpha or two of hMailsever 5.7 about that you could try (although not recommended on a live system)
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

leshan
New user
New user
Posts: 19
Joined: 2015-04-13 16:39

Re: hMailServer has run out of memory

Post by leshan » 2016-11-30 02:28

mattg wrote:There is always risks

I've not tried that, but then neither have I had need to.
That solution seems to have worked for others, butthen there is an alpha or two of hMailsever 5.7 about that you could try (although not recommended on a live system)
Ok, thanks. Can't wait for the production release of the 5.7.

Post Reply