login about faq

Using ChilkatMailMan2 sendQ method, an eml file gets created but the name of that file can only be found using a follow up step to retrieve the LastSendQFilename property. I am wondering if that property can be overwritten or changed by other concurrent mailman2 processes.

In my vb6 program, using mailman2 ActiveX, sendQ first creates the eml file in a local temp folder and then do a MoveFile to create a better named file in the actual local outgoing folder. One of my users who runs multiple email processes concurrently is experiencing sporadic failures to move the temp eml file (error 53: File not found).

Is it possible for another mailman instance running at the same time to interfere with the process so that LastSendQFilename returned by process A is actually the LastSendQFilename from process B?

Are there any other known issues that could cause the file name returned by LastSendQFilename to not be found even though sendQ reports success?

Thanks, - Ido

asked Feb 16 '13 at 12:48

ixm7's gravatar image

ixm7
632210


If two processes create an email at the exact same millisecond, AND it is the same Nth email for each process (for example, it is the 3rd email created for process A, and also the 3rd email created for process B), then there is a 1 in 4 billion chance that the random number generator would produce the same random number and there would be a collision of filenames.

link

answered Feb 20 '13 at 14:10

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

The filename generated by the SendQ method has this format:

    sprintf(fname,"e_%04d%02d%02d_%02d%02d%02d_%06x%03x.eml",
       m_date.wYear,m_date.wMonth,m_date.wDay,m_date.wHour,
       m_date.wMinute,m_date.wSecond,currentTickCount,GenFnameIdx++);
The filename contains the current date/time, the current system's tick count which is the number of milliseconds that have elapsed since the system was started, as well as an ever-increasing counter value for the current process (which starts at 0). A collision would occur if two separate processes generate their Nth file at the same exact millisecond. (For example, each process generates its 4th file at the same exact millisecond.)

link

answered Feb 18 '13 at 08:49

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

That may well explain these sporadic failures this user is seeing. Could you please add a new method or an overloaded argument that causes the name of the eml file to be always unique. For example, use a GUID.

link

answered Feb 18 '13 at 09:02

ixm7's gravatar image

ixm7
632210

Could you please confirm that 2 mailman processes running on the same machine would not share anything. 1) they don't share the GenFnameIdx 2) they don't share LastSendQFilename

link

answered Feb 18 '13 at 11:13

ixm7's gravatar image

ixm7
632210

edited Feb 18 '13 at 11:13

Here's a new build where the generated filename also includes the hex string for 4 random bytes. It should make everything unique.

http://www.chilkatsoft.com/preRelease/ChilkatMail2.zip

(Feb 18 '13 at 13:30) chilkat ♦♦

Thanks but could you please also let me know if 2 mailman processes running on the same machine might share 1) the GenFnameIdx 2) the LastSendQFilename

Or are these methods/properties totally isolated from other mailman2 instances on the same machine?

link

answered Feb 18 '13 at 14:18

ixm7's gravatar image

ixm7
632210

Just to confirm, the new component genarets this file name: e_20130218_193135_cf701e000C9A3B624.eml

link

answered Feb 18 '13 at 14:35

ixm7's gravatar image

ixm7
632210

could you please let me know if 2 mailman processes running on the same machine might share 1) the GenFnameIdx 2) the LastSendQFilename

Or are these methods/properties totally isolated from other mailman2 instances on the same machine?

link

answered Feb 20 '13 at 12:32

ixm7's gravatar image

ixm7
632210

I understand the answers you provided earlier as well as this last answer. But I'm also asking a different question. I'm asking if 2 instances of mailman2 might SHARE any properties or are they totally isolated from each other?

link

answered Feb 20 '13 at 15:19

ixm7's gravatar image

ixm7
632210

Each MailMan object instance is totally isolated from each other. The same is true for all other Chilkat objects.

(Feb 20 '13 at 16:50) chilkat ♦♦

That is exactly what I needed to hear. Thanks.

(Feb 20 '13 at 16:53) ixm7

Instead of including a random number for SendQ (with all the other extra timestamp numbers to make the filename unique), can't you just include the process id (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683215%28v=vs.85%29.aspx) or thread id to make a unique filename?

link

answered Feb 20 '13 at 15:39

Gert's gravatar image

Gert ♦
629141824

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×2
×1

Asked: Feb 16 '13 at 12:48

Seen: 1,526 times

Last updated: Feb 20 '13 at 16:53

powered by OSQA