IMAP's `fetch` results with extreme memory usage and computer freezing.
Open
Nobody has claimed this yet.
bug
- Dominant language
- Haskell
- Stars
- 92
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
I have written the following function using the HaskellNet and HaskellNet-SSL libraries.
Using the "fetch" function results with memory usage blowing up and extreme swapping.
What am I doing wrong? Might it be a bug?
import qualified Data.ByteString.Char8 as SB8
import Network.HaskellNet.IMAP
import Network.HaskellNet.IMAP.SSL
main = retrieveCSV
retrieveCSV = do
con <- connectIMAPSSL imapServer
login con username password
select con mailbox
lastMsg <- last <$> search con [ALLs]
-- this works:
_ <- fetchHeader con lastMsg
-- this works:
_ <- fetchSize con lastMsg
-- this blows up in memory usage:
_ <- fetch con lastMsg
undefined
where
imapServer = "imap.gmail.com"
username = "example" -- imagine this username is real
password = "example" -- imagine this password is real
mailbox = "example" -- imagine this mailbox is real
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing retrieveCSV with fetch con lastMsg and compare its memory use with fetchHeader and fetchSize. Trace the HaskellNet IMAP fetch entry point to determine whether the library or caller causes the excessive allocation; done means establishing the cause and verifying a focused fix or documented explanation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100