AppleEvents: received mach msg which wasn't complex type as expected in getMemoryReference.

Does anyone have an idea what this console message means? I’m trying to check why parts of my app are so slow in High Sierra.

I’m executing an AppleScript with NSAppleScriptMBS. Preparation of the script (this is just an example, the real scripts are a bit more complex):

MailScriptText.append "property Mailbox0: ''" MailScriptText.append "property Mailbox1: ''" MailScriptText.Append "property currentMessageStr: '0'" MailScriptText.Append "set currentMessage to currentMessageStr as integer" MailScriptText.append "tell application 'Mail'" MailScriptText.append "set theMessage to (message currentMessage of mailbox (Mailbox1) of account (Mailbox0))" MailScriptText.append "if not deleted status of theMessage then" MailScriptText.append "return source of theMessage" MailScriptText.append "end if" MailScriptText.append "end tell"

and then it’s executed - usually done in a loop for the whole mailbox:

dim theResult as NSAppleEventDescriptorMBS = theAppleScript.execute(theError)
When doing this I get the console message for each mail. And I can see the beachball quite often. For testing I usually do spam which is never very large.

  1. I would suggest that try the script in Apple Script Editor on the High Sierra machine and compare the results.

  2. I would also consider using a constant for the script and use the replace function to individualise the script. IMHO it makes it much easier for editing and checking the Apple Script.

@Sam Rowlands:

  1. I’ll try that.
  2. The real script is wwaaaaayyyyy more complex. The number of properties is dynamic together with the line “set message”. And finally the script is executed with ScriptProperties so that it needs to be compiled only once for each mailbox.

Result from executing the script in the ScriptEditor:

  • I don’t see the original error message. That would indicate a problem with the MBS plugin.

  • Is Mail now downloading each message again when the message is requested with AppleScript? The account is for testing and has only a couple of 100 mails. All mails are downloaded.

Console output:

standard 17:25:08.609056 +0200 Mail [Macsend - @r<5 chars><943B>] <Network Block Task - Get body> Task <IMAPNetworkBlockTask: 0x604000528660> mailboxName: @read; priorities - network: 30, reserved network: 0, persistence: 0 created
standard 17:25:08.609248 +0200 Mail [Macsend - @r<5 chars><943B>] <Network Block Task - Get body> Operation {<IMAPNetworkBlockOperation: 0x600001e8ec90>} created
standard 17:25:08.609303 +0200 Mail [Macsend - @r<5 chars><943B>] <Network Block Task - Get body> 0x604000528660 now scheduled
standard 17:25:08.609906 +0200 Mail [macsend.de] <0x7f91404b1f20:[Idle mailbox=To<5 chars><5B38>]> Wrote: DONE
standard 17:25:08.974828 +0200 Mail [macsend.de] <0x7f91404b1f20:[Idle mailbox=To<5 chars><5B38>]> Read: 46.2885 OK
standard 17:25:08.975464 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Wrote: 47.2885 SELECT @r<5 chars><943B>
standard 17:25:09.210007 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * FLAGS (\Draft \Answered $AutoNotJunk $MDNSent $Forwarded \Deleted \Flagged $AutoJunk $Junk $NotJunk \Seen)
standard 17:25:09.210167 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * EXISTS 192
standard 17:25:09.210295 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * RECENT 0
standard 17:25:09.210460 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * OK [UIDVALIDITY 1374234812]
standard 17:25:09.210609 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * OK [UIDNEXT 806]
standard 17:25:09.210862 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * OK [PERMANENTFLAGS {(
“\\Draft”,
“\\Answered”,
“$AutoNotJunk”,
“$MDNSent”,
“$Forwarded”,
“\\Deleted”,
“\\Flagged”,
“$AutoJunk”,
“$Junk”,
“$NotJunk”,
“\\Seen”
)}]
standard 17:25:09.210990 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: 47.2885 OK [READ-WRITE]
standard 17:25:09.212230 +0200 Mail [Macsend - @r<5 chars><943B>] <IMAPNetworkBlockTask - Wait for body data> running inline
standard 17:25:09.212537 +0200 Mail [Macsend - To<5 chars><5B38>] Reset mailbox in sync state
standard 17:25:09.212973 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Wrote: 48.2885 UID FETCH 771 (BODY.PEEK[] BODYSTRUCTURE)
standard 17:25:09.213625 +0200 Mail [Macsend - @r<5 chars><943B>] Created mailbox sync task with IMAPMailbox with progress 0x600000530540
standard 17:25:09.215652 +0200 Mail [Macsend - @r<5 chars><943B>] Has no work (allow: 1, force: 0) for IMAPMailbox [exists: 192, unseen: 0, UID next: 806, UID validity: 1374234812, highest modseq: 0] and local data [exists: 192, unseen: 0, UID next: 806, UID validity: 1374234812, highest modseq: 0], can trust exists: 1, supports modseq: 0
standard 17:25:09.215994 +0200 Mail [Macsend - @r<5 chars><943B>] Recalculated priorities - network: 0, persistence: 0
standard 17:25:09.216053 +0200 Mail [Macsend - @r<5 chars><943B>] Stopped using display count
standard 17:25:14.726689 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: * FETCH 158(UID 771 )
standard 17:25:14.726852 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=@r<5 chars><943B>]> Read: 48.2885 OK
standard 17:25:14.736573 +0200 Mail [Macsend - @r<5 chars><943B>] <IMAPNetworkBlockTask - Wait for body data> finished
standard 17:25:14.737043 +0200 Mail (null) Task <IMAPPersistenceBlockTask: 0x6040012f0d00> dataSource: S{MFLibraryIMAPStore <MFMailbox: 0x7f9139f4efb0> @r<5 chars><943B> <MFIMAPAccount: 0x7f9139d17ea0> bw macsend.de (77BA2C96-A2BD-4C49-B198-CB3F88AAD5A1)} created
standard 17:25:14.760096 +0200 Mail (null) Task <IMAPPersistenceBlockTask: 0x6040012f0d00> dataSource: S{MFLibraryIMAPStore <MFMailbox: 0x7f9139f4efb0> @r<5 chars><943B> <MFIMAPAccount: 0x7f9139d17ea0> bw macsend.de (77BA2C96-A2BD-4C49-B198-CB3F88AAD5A1)} finished
standard 17:25:14.760423 +0200 Mail [Macsend - @r<5 chars><943B>] <Network Block Task - Get body> Operation {<IMAPNetworkBlockOperation: 0x600001e8ec90>} finished
standard 17:25:14.760527 +0200 Mail [Macsend - @r<5 chars><943B>] <Network Block Task - Get body> Task <IMAPNetworkBlockTask: 0x604000528660> mailboxName: @read; priorities - network: 0, reserved network: 0, persistence: 0 finished
standard 17:25:14.760818 +0200 Mail [Macsend] Switching handler (0x6000010f2d00) to idle on secondary mailbox: To<5 chars><5B38>
standard 17:25:14.762325 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Wrote: 49.2885 SELECT To<5 chars><5B38>
standard 17:25:14.983201 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * FLAGS (\Draft \Answered $AutoNotJunk $MDNSent $Forwarded \Deleted \Flagged $AutoJunk $Junk $NotJunk \Seen)
standard 17:25:14.983333 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * EXISTS 0
standard 17:25:14.983480 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * RECENT 0
standard 17:25:14.983663 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * OK [UIDVALIDITY 1458382372]
standard 17:25:14.983802 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * OK [UIDNEXT 1]
standard 17:25:14.983976 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: * OK [PERMANENTFLAGS {(
“\\Draft”,
“\\Answered”,
“$AutoNotJunk”,
“$MDNSent”,
“$Forwarded”,
“\\Deleted”,
“\\Flagged”,
“$AutoJunk”,
“$Junk”,
“$NotJunk”,
“\\Seen”
)}]
standard 17:25:14.984186 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: 49.2885 OK [READ-WRITE]
standard 17:25:14.984494 +0200 Mail [Macsend - @r<5 chars><943B>] Reset mailbox in sync state
standard 17:25:14.985039 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Wrote: 50.2885 IDLE
standard 17:25:14.985077 +0200 Mail [Macsend - To<5 chars><5B38>] Created mailbox sync task with IMAPMailbox with progress 0x604000733f60
standard 17:25:14.985917 +0200 Mail [Macsend - To<5 chars><5B38>] Has no work (allow: 1, force: 0) for IMAPMailbox [exists: 0, unseen: 0, UID next: 1, UID validity: 1458382372, highest modseq: 0] and local data [exists: 0, unseen: 0, UID next: 1, UID validity: 1458382372, highest modseq: 0], can trust exists: 1, supports modseq: 0
standard 17:25:14.986174 +0200 Mail [Macsend - To<5 chars><5B38>] Recalculated priorities - network: 0, persistence: 0
standard 17:25:14.986251 +0200 Mail [Macsend - To<5 chars><5B38>] Stopped using display count
standard 17:25:15.190543 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: +
standard 17:25:15.191234 +0200 Mail [Macsend - (null)] <Network Block Task - Expunge> Task <IMAPNetworkBlockTask: 0x6040005386a0> mailboxName: (null); priorities - network: 31, reserved network: 0, persistence: 0 created
standard 17:25:15.191376 +0200 Mail [Macsend - (null)] <Network Block Task - Expunge> Operation {<IMAPNetworkBlockOperation: 0x604000281810>} created
standard 17:25:15.191429 +0200 Mail [Macsend - (null)] <Network Block Task - Expunge> 0x6040005386a0 now scheduled
standard 17:25:15.191835 +0200 Mail [macsend.de] <0x7f91404b1f20:[Idle mailbox=To<5 chars><5B38>]> Wrote: DONE
standard 17:25:15.420735 +0200 Mail [macsend.de] <0x7f91404b1f20:[Idle mailbox=To<5 chars><5B38>]> Read: 50.2885 OK
standard 17:25:15.421100 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Wrote: 51.2885 EXPUNGE
standard 17:25:15.634928 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: 51.2885 OK
standard 17:25:15.635367 +0200 Mail [Macsend - (null)] <Network Block Task - Expunge> Operation {<IMAPNetworkBlockOperation: 0x604000281810>} finished
standard 17:25:15.635588 +0200 Mail [Macsend - (null)] <Network Block Task - Expunge> Task <IMAPNetworkBlockTask: 0x6040005386a0> mailboxName: (null); priorities - network: 0, reserved network: 0, persistence: 0 finished
standard 17:25:15.636196 +0200 Mail [Macsend] Assigning idle operation to handler (0x6000010f2d00) for mailbox: To<5 chars><5B38>
standard 17:25:15.636775 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Wrote: 52.2885 IDLE
standard 17:25:15.865945 +0200 Mail [macsend.de] <0x7f91404b1f20:[Selected mailbox=To<5 chars><5B38>]> Read: +