Pegasus Mail & Mercury

Welcome to the Community for Pegasus Mail and
The Mercury Mail Transport System, the Internet's longest-serving PC e-mail system!
Welcome to Pegasus Mail & Mercury Sign in | Join | Help
in
Home Blogs Forums Downloads Pegasus Mail Overview Mercury Overview Wiki

Serious Thread/Memory leak - Win7-64 & PMail 4.52

Last post 03-28-2011, 20:51 by bosjo. 7 replies.
Sort Posts: Previous Next
  •  08-30-2010, 23:27

    • kingstairs is not online. Last active: 08 Sep 2010, 8:27 kingstairs
    • Not Ranked
    • Joined on 08-30-2010
    • Palm Springs, CA
    • Member
    • Points 60

    Serious Thread/Memory leak - Win7-64 & PMail 4.52

    Background: Pegasus Mail 4.52, dual-core AMD, Windows 7 Ultimate (64-bit), POP3 account (SSL encrypted)

    On startup, PMail uses about 6MB RAM, 85 handles and 2 threads (according to both Task Manager and Resource Monitor).

    Every time PMail checks for mail (manually or by scheduled polling), the thread count goes up 3-4 during the check, but then only drops back 2-3 (ie a net increase of 1-2 thread handles). This is consistent, and results in a creeping increase in threads. Memory and handle usage also increase, even if no actual work (no new mail) is being done. I haven't verified whether sending mail also leaks.

    By itself, this is not a problem, but at some point (usually when the thread count reaches 1,400+ and memory usage hits 100MB+), PMail stops responding properly: CPU usage jumps to ~50% but it doesn't seem to be doing anything (I suspect a scheduled new mail poll triggers it). I can close PMail via File|Exit, but that only closes the main window; the process is still sitting there and has to be forcefully killed.

    The end result is that I have to restart Pegasus every few days.

    I am not noticing any other anomalous behavior.

    Michael

     
  •  08-30-2010, 23:46

    • idw is not online. Last active: Sat, Sep 21 2019, 15:37 idw
    • Top 10 Contributor
    • Joined on 03-25-2007
    • Germany
    • SuperStar
    • Points 47,175
    • BetaTeam

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    kingstairs:
    On startup, PMail uses about 6MB RAM, 85 handles and 2 threads (according to both Task Manager and Resource Monitor).

    Every time PMail checks for mail (manually or by scheduled polling), the thread count goes up 3-4 during the check, but then only drops back 2-3 (ie a net increase of 1-2 thread handles). This is consistent, and results in a creeping increase in threads. Memory and handle usage also increase, even if no actual work (no new mail) is being done. I haven't verified whether sending mail also leaks

    I cannot duplicate this, at least not within a short period of time: The thread count on my system (almost identical) constantly varies between 8 and 12. There must be something else involved.



    Michael

    --
    PGP Key ID (RSA 2048): 0xC45D831B
    PGP Plugin for Pegasus Mail: <http://www.pmpgp.de/pmpgp/>
    S/MIME Certificate Fingerprint: 26 5c a3 60 02 c6 e3 8a 75 70 d5 6a 67 ff d3 8d b0 b5 5e 5b
  •  09-02-2010, 2:49

    • kingstairs is not online. Last active: 08 Sep 2010, 8:27 kingstairs
    • Not Ranked
    • Joined on 08-30-2010
    • Palm Springs, CA
    • Member
    • Points 60

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    It's definitely consistent on my system, even after a Windows Update and reboot this morning.

    I had Process Explorer look at the DLL's loaded (see below) - nothing looks out of the ordinary. As the problem only occurs when polling, it might be related to the firewall (Agnitum Outpost), but then I'd also expect to see something unusual happening with Firefox or FeedDemon (which isn't).

    Process: winpm-32.exe Pid: 148

    Name    Description    Company Name    Version
    ADVAPI32.dll    Advanced Windows 32 Base API    Microsoft Corporation    6.1.7600.16385
    apphelp.dll    Application Compatibility Client Library    Microsoft Corporation    6.1.7600.16385
    BEARHTML.DLL    BearHtml.dll for Pegasus Mail    Martin Ireland    4.6.3.0
    cl32.dll    cryptlib security toolkit    Peter Gutmann    3.2.2.0
    COMCTL32.dll    User Experience Controls Library    Microsoft Corporation    6.10.7600.16385
    comctl32.dll.mui    User Experience Controls Library    Microsoft Corporation    6.10.7600.16385
    comdlg32.dll    Common Dialogs DLL    Microsoft Corporation    6.1.7600.16385
    CRYPT32.dll    Crypto API32    Microsoft Corporation    6.1.7600.16385
    CRYPTBASE.dll    Base cryptographic API DLL    Microsoft Corporation    6.1.7600.16385
    CRYPTSP.dll    Cryptographic Service Provider API    Microsoft Corporation    6.1.7600.16385
    dnsapi.dll    DNS Client API DLL    Microsoft Corporation    6.1.7600.16385
    dwmapi.dll    Microsoft Desktop Window Manager API    Microsoft Corporation    6.1.7600.16385
    FreeImage.dll    FreeImage library    FreeImage    3.10.0.0
    GDI32.dll    GDI Client DLL    Microsoft Corporation    6.1.7600.16385
    HTS32.DLL    HTML Add-on    Sub Systems, Inc.     10.0.1.5
    ICONV.DLL    LGPLed libiconv for Windows NT/2000/XP/Vista and Windows 95/98/ME    Free Software Foundation; patched and compiled by Michael in der Wiesche <idw.doc@t-online.de>, 2009-07-15    1.13.1.0
    iertutil.dll    Run time utility for Internet Explorer    Microsoft Corporation    8.0.7600.16385
    IMM32.dll    Multi-User Windows IMM32 API Client DLL    Microsoft Corporation    6.1.7600.16385
    IPHLPAPI.DLL    IP Helper API    Microsoft Corporation    6.1.7600.16385
    kernel32.dll    Windows NT BASE API Client DLL    Microsoft Corporation    6.1.7600.16385
    KERNELBASE.dll    Windows NT BASE API Client DLL    Microsoft Corporation    6.1.7600.16385
    libtidy.dll    HTML Tidy Library for Pegasus Mail    Micha's Midnight Manufacture    1.0.1.0
    locale.nls           
    LPK.dll    Language Pack    Microsoft Corporation    6.1.7600.16385
    MSASN1.dll    ASN.1 Runtime APIs    Microsoft Corporation    6.1.7600.16415
    MSCTF.dll    MSCTF Server DLL    Microsoft Corporation    6.1.7600.16385
    MSFTEDIT.DLL    Rich Text Edit Control, v4.1    Microsoft Corporation    5.41.21.2509
    MSIMG32.dll    GDIEXT Client DLL    Microsoft Corporation    6.1.7600.16385
    msvcrt.dll    Windows NT CRT DLL    Microsoft Corporation    7.0.7600.16385
    mswsock.dll    Microsoft Windows Sockets 2.0 Service Provider    Microsoft Corporation    6.1.7600.16385
    NetAPI32.dll    Net Win32 API DLL    Microsoft Corporation    6.1.7600.16385
    netutils.dll    Net Win32 API Helpers DLL    Microsoft Corporation    6.1.7600.16385
    Normaliz.dll    Unicode Normalization DLL    Microsoft Corporation    6.1.7600.16385
    NSI.dll    NSI User-mode interface DLL    Microsoft Corporation    6.1.7600.16385
    ntdll.dll    NT Layer DLL    Microsoft Corporation    6.1.7600.16559
    ntdll.dll    NT Layer DLL    Microsoft Corporation    6.1.7600.16559
    ODBC32.DLL    ODBC Driver Manager    Microsoft Corporation    6.1.7600.16385
    odbcint.dll    ODBC Resources    Microsoft Corporation    6.1.7600.16385
    odbcint.dll.mui    ODBC Resources    Microsoft Corporation    6.1.7600.16385
    ole32.dll    Microsoft OLE for Windows    Microsoft Corporation    6.1.7600.16385
    OLEAUT32.dll        Microsoft Corporation    6.1.7600.16567
    profapi.dll    User Profile Basic API    Microsoft Corporation    6.1.7600.16385
    rasadhlp.dll    Remote Access AutoDial Helper    Microsoft Corporation    6.1.7600.16385
    RPCRT4.dll    Remote Procedure Call Runtime    Microsoft Corporation    6.1.7600.16385
    rsaenh.dll    Microsoft Enhanced Cryptographic Provider    Microsoft Corporation    6.1.7600.16385
    sechost.dll    Host for SCM/SDDL/LSA Lookup APIs    Microsoft Corporation    6.1.7600.16385
    SHELL32.dll    Windows Shell Common Dll    Microsoft Corporation    6.1.7600.16644
    SHLWAPI.dll    Shell Light-weight Utility Library    Microsoft Corporation    6.1.7600.16385
    SortDefault.nls           
    sqlite3.dll           
    srvcli.dll    Server Service Client DLL    Microsoft Corporation    6.1.7600.16385
    SspiCli.dll    Security Support Provider Interface    Microsoft Corporation    6.1.7600.16484
    StaticCache.dat           
    TER32.DLL    TE Edit Control    Sub Systems, Inc.     15.0.4.5
    urlmon.dll    OLE32 Extensions for Win32    Microsoft Corporation    8.0.7600.16625
    USER32.dll    Multi-User Windows USER API Client DLL    Microsoft Corporation    6.1.7600.16385
    user32.dll.mui    Multi-User Windows USER API Client DLL    Microsoft Corporation    6.1.7600.16385
    USP10.dll    Uniscribe Unicode script processor    Microsoft Corporation    1.626.7600.16385
    uxtheme.dll    Microsoft UxTheme Library    Microsoft Corporation    6.1.7600.16385
    VERSION.dll    Version Checking and File Installation Libraries    Microsoft Corporation    6.1.7600.16385
    wi_sph.dll    Bayesian Spamwall plugin for Pegasus Mail    Lukas Gebauer, Czech Republic    4.5.0.165
    WININET.DLL    Internet Extensions for Win32    Microsoft Corporation    8.0.7600.16625
    WINMM.dll    MCI API DLL    Microsoft Corporation    6.1.7600.16385
    WINNSI.DLL    Network Store Information RPC interface    Microsoft Corporation    6.1.7600.16385
    winpm-32.exe    Pegasus Mail for Windows    David Harris    4.5.2.0
    WINSPOOL.DRV    Windows Spooler Driver    Microsoft Corporation    6.1.7600.16385
    WINTRUST.dll    Microsoft Trust Verification APIs    Microsoft Corporation    6.1.7600.16493
    wkscli.dll    Workstation Service Client DLL    Microsoft Corporation    6.1.7600.16385
    wl_hook.dll    Outpost Hooking Module    Agnitum Ltd.    7.1.3376.11418
    wldap32.dll    Win32 LDAP API DLL    Microsoft Corporation    6.1.7600.16385
    wow64.dll    Win32 Emulation on NT64    Microsoft Corporation    6.1.7600.16491
    wow64cpu.dll    AMD64 Wow64 CPU     Microsoft Corporation    6.1.7600.16385
    wow64win.dll    Wow64 Console and Win32 API Logging    Microsoft Corporation    6.1.7600.16385
    ws2_32.dll    Windows Socket 2.0 32-Bit DLL    Microsoft Corporation    6.1.7600.16385
    wsock32.dll    Windows Socket 32-Bit DLL    Microsoft Corporation    6.1.7600.16385
     

  •  09-02-2010, 19:06

    • idw is not online. Last active: Sat, Sep 21 2019, 15:37 idw
    • Top 10 Contributor
    • Joined on 03-25-2007
    • Germany
    • SuperStar
    • Points 47,175
    • BetaTeam

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    kingstairs:

    It's definitely consistent on my system, even after a Windows Update and reboot this morning.

    I had Process Explorer look at the DLL's loaded (see below) - nothing looks out of the ordinary. As the problem only occurs when polling, it might be related to the firewall (Agnitum Outpost), but then I'd also expect to see something unusual happening with Firefox or FeedDemon (which isn't).

     What about your AV-scanner? What about message filters? Any extensions (although I don't see any known ones in the module list you posted)? I'm afraid you'll have to figure it out yourself if nobody else can duplicate it ...

    Michael

    --
    PGP Key ID (RSA 2048): 0xC45D831B
    PGP Plugin for Pegasus Mail: <http://www.pmpgp.de/pmpgp/>
    S/MIME Certificate Fingerprint: 26 5c a3 60 02 c6 e3 8a 75 70 d5 6a 67 ff d3 8d b0 b5 5e 5b
  •  09-08-2010, 8:16

    • kingstairs is not online. Last active: 08 Sep 2010, 8:27 kingstairs
    • Not Ranked
    • Joined on 08-30-2010
    • Palm Springs, CA
    • Member
    • Points 60

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    Message filters are (presumably) not an issue as the leak occurs even if no messages are downloaded. No Pegasus extensions are installed. As for AV - I don't use e-mail scanners.

    I updated Outpost to the current release (7.0.3) and tried disabling the Outpost malware scanner, but that had no effect (as expected).

    If I ever get enough free time (what's that? Hmm) I'll try using SysInternals Process Monitor - that might at least identify where the leaked threads are being created (PMail or a loaded DLL)...

  •  03-28-2011, 3:22

    • bosjo is not online. Last active: 04-28-2011, 16:31 bosjo
    • Not Ranked
    • Joined on 09-20-2008
    • Member
    • Points 30

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    I'm having similar problems, with PMail increasing the number of threads and amount of memory until the program hangs (Win7-64, PMail 4.61, Intel Dualcore).

    Following the suggestion of the previous poster, I downloaded Process Monitor, and what I found was that of the threads created in each "POP3 cycle", there is one that never exits. The squence of events that can be followed with the Process Monitor is

    (1) PMail reads some values from the registry

    (2) PMail reads winpm-32.dat

    (3) PMail creates two new threads; it is the second of these that never exits.

    (4) PMail then loads NLAapi.dll, ... and so on

    I have a suspicion that my problem might be due to the fact that I put my mail data on a NAS -- the idea, once upon a time, was that I should be able to read my mail from several different computers (only one at a time, of course). That failed because I could not get PMail to work on Vista because of similar problems (at the time I did not investigate it; it worked on the XP system, so I kept it for this purpose). Can someone confirm that PMail may have problems with mapped drive letters on the network? If so, is there some kind of workaround, or must I move the data to the computer?

    If someone is interested in a event log, I am of course more than willing to provide one.

    /Bo S


  •  03-28-2011, 15:22

    • idw is not online. Last active: Sat, Sep 21 2019, 15:37 idw
    • Top 10 Contributor
    • Joined on 03-25-2007
    • Germany
    • SuperStar
    • Points 47,175
    • BetaTeam

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    bosjo:
    I'm having similar problems, with PMail increasing the number of threads and amount of memory until the program hangs (Win7-64, PMail 4.61, Intel Dualcore).


    Here's David Harris' reply:

    I've never seen it, nor other reports of it, but I can tell at a glance what must be happening... A WinSock function (most likely "connect") is never returning control. There are no loops in my threaded TCP/IP code that would not eventually time out, so the only way what he describes can be happening is if one of the WinSock functions never returns.

    This will be a system-level problem of some kind - there's nothing I can do to mitigate it in any way. On the occasions where we've seen this type of problem in the past, nVidia motherboard ethernet controllers, controllers with poor packet fragmentation handling, and occasionally A/V packages that attempt to inject themselves into mail transactions have been the most likely causes.


    Michael

    --
    PGP Key ID (RSA 2048): 0xC45D831B
    PGP Plugin for Pegasus Mail: <http://www.pmpgp.de/pmpgp/>
    S/MIME Certificate Fingerprint: 26 5c a3 60 02 c6 e3 8a 75 70 d5 6a 67 ff d3 8d b0 b5 5e 5b
  •  03-28-2011, 20:51

    • bosjo is not online. Last active: 04-28-2011, 16:31 bosjo
    • Not Ranked
    • Joined on 09-20-2008
    • Member
    • Points 30

    Re: Serious Thread/Memory leak - Win7-64 & PMail 4.52

    Thanks for that. However, I don't think the problem is in Winsock (even if I of course don't know what is happening internally in PMail) since the POP3 lookup seems to be working just fine. I have fiddled around a bit with Process Manager, found out how to add thread id to the output, and so on, and I have created two screendumps of what is happening, one in the Win7 computer, and one in the old XP computer; I give only the URLs here as they are fairly big -- http://bozze.hopto.org/pmail.png and http://bozze.hopto.org/pmail_xp.png.

    As can be seen from these, the program makes three connections to the socket, which is expected since I have set up 3 boxes to be checked every 61 seconds, or something like that; and all events reports success. The difference is that the thread that is loading winrnr.dll (and a lot of other dlls on WIn7) does not exit in the Win7 example (thread id 13284), but does so in XP (thread id 27264).

    I will make some more experiments with mailboxes, anit-virus, etc, but all suggestions are welcome... I am also a bit confused about the wording "my threaded TCP/IP code", as it seems that all TCP/IP calls are made in the main thread. Is something in my setup wrong?

View as RSS news feed in XML

Contact | Advertise | Host provider: PraktIT | Terms of Use | Privacy Statement
Copyright © 2007-2011 David Harris / Peter Strömblad. | Pegasus Mail Home Page