Issues while running under multiple processes - 4.0.0-b5

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
KevinC
Forum Newbie
Posts: 8
Joined: Sun Feb 15, 2009 12:01 pm

Issues while running under multiple processes - 4.0.0-b5

Post by KevinC »

In our performance benchmarks test I occasionally see these errors:

-----
Warning: rmdir(C:\aaa\bbb\/499981cb74fa2): Directory not empty in D:\path_to_lib\classes\Swift\KeyCache\DiskKeyCache.php on line 264
PHP Warning: unlink(C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\/499981ef0d181/body): Permission denied in D:\path_to_lib\classes\Swift\KeyCache\DiskKeyCache.php on line 247

Warning: unlink(C:\aaa\bbb\/499981ef0d181/body): Permission denied in D:\path_to_lib\classes\Swift\KeyCache\DiskKeyCache.php on line 247
PHP Warning: rmdir(C:\aaa\bbb\/499981ef0d181): No such file or directory in D:\path_to_lib\classes\Swift\KeyCache\DiskKeyCache.php on line 264
-----

These are from a Windows Server running the Swiftmailer under multiple processes.
I believe I have also seen this under Linux.
This is only while stressing the library under multiple instances - and then we only see a couple of these errors.

(of course "\aaa\bbb" and "\path_to_lib" are substitutions)

Thanks,
Kevin
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Issues while running under multiple processes - 4.0.0-b5

Post by Chris Corbyn »

Hmm, that's odd and I'm not sure how that could happen. When you say under multiple processes, are how you doing this specifically? I'm wondering if there are collisions with the cache file name generation.
KevinC
Forum Newbie
Posts: 8
Joined: Sun Feb 15, 2009 12:01 pm

Re: Issues while running under multiple processes - 4.0.0-b5

Post by KevinC »

Under windows we are running under multiple processes by running these php scripts from the command line and using multiple instances of "cmd" windows.

Under LINUX we simple fork the process to the background using a terminating "&". We then issue the batch command multiple times in a row.

In either case we have multiple instances of PHP & Swift Mailer running, each looping through the building of thousands of emails per minute.

Thanks,
Kevin
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Issues while running under multiple processes - 4.0.0-b5

Post by Chris Corbyn »

Thanks Kevin, I'll try to replicate this and pin down the cause.
intermesh
Forum Newbie
Posts: 1
Joined: Tue Apr 07, 2009 5:14 am

Re: Issues while running under multiple processes - 4.0.0-b5

Post by intermesh »

This issue is still not solved in 4.0.3. When I send a mail from a script that is executed in the background on a command line with popen()
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Issues while running under multiple processes - 4.0.0-b5

Post by Chris Corbyn »

Hmm... I think I can see the problem...

Swift uses paths that have a forward slash, which PHP should support on all platforms. However, the base path here seems to end with a backslash:

C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\/499981ef0d181/body

Notice the "1\/499981ef0d181" part. I think that will mess with the script.

Out of curiosity, did you specify the temp path yourself, or are you just using Swift Mailer defaults?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Issues while running under multiple processes - 4.0.0-b5

Post by Chris Corbyn »

I'm just looking at the code that clears the cache items, it doesn't try to do anything naive such as deleting the entire cache directory, it's namespaced by unique random keys and each cache item has a unique id too. The cache only deletes files it is authorative for.

One thing that would cause conflicts is using pcntl_fork() rather then popen() since, if I understand what pcntl_fork() does it will copy the same unique IDs etc into the forked process.
Hocker
Forum Newbie
Posts: 3
Joined: Wed Mar 25, 2009 10:54 am

Re: Issues while running under multiple processes - 4.0.0-b5

Post by Hocker »

Well I am not running under multiple processes but can see the same message from time to time,
even if I use the script to send one email.
When sending batches it appears randomly, 90% of the time everything goes smoothly but I still get
the error on the other 10%.
Post Reply