Skip to content

MemoryError when using Maildir with large emails (>10MB) #722

@fcueto

Description

@fcueto

General informations

  • system/distribution (with version): Linux 4.9.0-19-686-pae #1 SMP Debian 4.9.320-2 (2022-06-30) i686 GNU/Linux
  • offlineimap version (offlineimap -V): 7.3.4
  • Python version: 2.7.13
  • server name or domain: N/A
  • CLI options:

Configuration file offlineimaprc

[general]
accounts = Gmail
maxsyncaccounts = 1
ui = basic
socktimeout = 30

[Account Gmail]
localrepository = Local
remoterepository = Remote
autorefresh = 2
quick = 10

[Repository Local]
type = Maildir
localfolders = ~/Maildir
sep = .
nametrans = lambda foldername:  re.sub('.Drafts', '[Gmail].Drafts',
                                re.sub('.Sent', '[Gmail].Sent Mail',
                                re.sub('.Trash', '[Gmail].Trash', foldername)))


[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
starttls = no
remoteuser = xxx
auth_mechanisms = XOAUTH2
oauth2_client_id = xxx.apps.googleusercontent.com
oauth2_client_secret = xxx
oauth2_request_url = https://accounts.google.com/o/oauth2/token
oauth2_refresh_token = xxx
maxconnections = 1
keepalive = 60

folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/Sent Mail', '[Gmail]/Drafts', '[Gmail]/Trash']
nametrans = lambda foldername:  re.sub('.*Drafts$', '.Drafts',
                                re.sub('.*Sent Mail$', '.Sent',
                                re.sub('.*Trash$', '.Trash',
                                re.sub('^INBOX', '', foldername))))

pythonfile (if any)

N/A

Logs, error

2022-08-10 18:10:49 ERROR: ERROR: Copying message -1 [acc: Gmail]
  
2022-08-10 18:10:49 ERROR: ERROR: while syncing  [account Gmail]
  
2022-08-10 18:10:49 ERROR: ERROR: ERROR in syncfolder for Gmail folder : Traceback (most recent call last):
  File "/home/user/install/offlineimap-7.3.0/offlineimap/accounts.py", line 662, in syncfolder
    localfolder.syncmessagesto(remotefolder, statusfolder)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 1116, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 944, in __syncmessagesto_copy
    self.copymessageto(uid, dstfolder, statusfolder, register=0)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 839, in copymessageto
    message = self.getmessage(uid)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Maildir.py", line 273, in getmessage
    retval = file.read()
MemoryError

Steps to reproduce the error

Trying to sync Maildir<->Gmail with an email >10MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions