-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue reading from /tmp directory in build environment #1
Comments
Could you be re-using the same mail fixtures over and over in your test suite? If so, the test suite could be clobbering results. If that is the case you could submit a patch that creates a truely random director for @media_dir |
This could indeed be the case. For generating random file names, I've had success using:
Do you think that would make sense? thx |
I think you can keep it simple by introducing the current time or a random number as part of the directory hierarchy. Then messages that are processed multiple times will be retained in unique directory hierarchies
or
|
I don't like using time since that could break in a multithreaded environment. I'm not sure of the specifics of the rand function but i know uuid is guaranteed to be unique.
|
I'm hesitant to bring in a dependency on the uuidtools gem (http://uuidtools.rubyforge.org/) into the main functionality of MMS2R to satisfy an somewhat edge case scenario in a testing environment. |
Makes sense. I would use an alternate method of generating a random unique string if I new it would always work. I have ran into issues in the past with rand methods that were based on time and not always that random. I'm not too sure that you would never run into a scenario like this in multi-threaded environments. To me it just seems like we are making mms2r that much more bullet proof. thx. |
In a threaded environment, given an app like Twitpic that posts MMS media to a feed, if the app starts processing the same message multiple times, then that's a flaw with the application, not with MMS2R. In a scenario like that, the app could work on each message using a work queue, or other similar methodology. MMS2R makes the assumption that each message is unique in terms of the value in its Message-ID header as can be seen in the logic to derive a temporary directory to decode all of its media. To me, in a threaded testing environment that has no work queue, and is setting up and tearing down the same message fixture over and over, that 1:1,000,000 randomness is good enough. Such as:
|
Makes sense. |
I added your fork into the latest 2.4.0 version if you hadn't noticed, thanks |
I am getting the following error when running tests from concurrent builds.
/usr/bin/ruby18 -I "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.96/lib:lib" "/usr/lib64/ruby/gems/1.8/gems/cucumber-0.3.96/bin/cucumber" --profile firefox35 --format pretty --format html --out=/data/homedirs/cosmos/.hudson/jobs/firefox35/workspace/log/cucumber/html/cucumber_firefox35_results.html features/current
Using the firefox35 profile...
Unable to load thrift_native extension. Defaulting to pure Ruby libraries.
spawned dj pid 4556
No such file or directory - /tmp/mms2r/9F8813E4DB0BB740A4E475B593C6E4D31E38928Fgsmbnop12esfirmwidecorpgscom/2/1253664813.98513.html (Errno::ENOENT)
/usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:418:in
initialize' /usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:418:in
open'/usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:418:in
process_media' /usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:354:in
process'(eval):3:in
each_without_optional_block' (eval):3:in
each'/usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:351:in
process' /usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:233:in
initialize'/usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:113:in
orig_new' /usr/lib64/ruby/gems/1.8/gems/mms2r-2.2.0/lib/mms2r/media.rb:113:in
new'/data/homedirs/cosmos/.hudson/jobs/firefox35/workspace/app/models/email/message.rb:113:in
rfc822_attachments' /data/homedirs/cosmos/.hudson/jobs/firefox35/workspace/app/models/email/message.rb:99:in
build_from_tmail'./db/populate/02_demo_users.rb:21
It looks to me that this is because more than one process is reading the same email with the same message_id concurrently.
Looking at the code, all processes running as the same user share the same tmp directory.
And the media_dir is a product of the tmpdir using hte message id and the current time:
The text was updated successfully, but these errors were encountered: