Issue Type: Bug Bug
Affects Versions: JRuby 1.6.7
Assignee: Thomas E Enebo
Attachments: email_test.rb, the_email.txt
Components: Standard Library
Created: 31/Jul/12 9:20 AM
Description:

Deploying a Rails application with JRuby to production is impossible due to the fact that JRuby has a bug when using IO.popen and sendmail.rb (%GEM_HOME%/gems/mail-2.4.4/lib/mail/network/delivery_methods/sendmail.rb)
depends on this functionality.

I have isolated the issue and have a tiny script that when run under MRI ruby will email. The same script, when run via jruby, has no errors and no email is ever sent. Monitoring of /var/log/maillog confirms this.

Consider the following script (email_test.rb):

 
def file_as_string(file)
	rVal = ''
	File.open(file, 'r') do |file_handle|
		file_handle.read.each_line do |line|
			rVal << line
		end
	end
	rVal
end
IO.popen("/usr/sbin/sendmail -i -t -f \"cristopher.sh...@va.gov\" cristopher.sh...@va.gov", "w+") do |io|
  email = file_as_string("/tmp/the_email.txt")
  io.puts email
  io.flush
end

#from sendmail.rb
#  def self.call(path, arguments, destinations, mail)
#    IO.popen("#{path} #{arguments} #{destinations}", "w+") do |io|
#      io.puts mail.encoded.to_lf
#      io.flush
#    end
#  end

when run via MRI ruby as follows:

 /u01/dev/ruby_1.8.7/bin/ruby /tmp/email_test.rb

Then sendmail's log (/var/log/maillog) is filled with activity, and an email arrives:

Jul 31 09:11:25 vahdrtvapp05 sendmail[11520]: q6VEBO2a011520: Authentication-Warning: vahdrtvapp05.aac.va.gov: t192zcs set sender to cristopher.sh...@va.gov using -f
Jul 31 09:11:25 vahdrtvapp05 sendmail[11520]: q6VEBO2a011520: from=cristopher.sh...@va.gov, size=359, class=0, nrcpts=1, msgid=<5017ded29f6c8_5487e267...@vahdrtvapp05.aac.va.gov.mail>, relay=t192zcs@localhost
Jul 31 09:11:25 vahdrtvapp05 sendmail[11524]: q6VEBPPt011524: from=<cristopher.sh...@va.gov>, size=631, class=0, nrcpts=1, msgid=<5017ded29f6c8_5487e267...@vahdrtvapp05.aac.va.gov.mail>, proto=ESMTP, daemon=NoMTA4, relay=localhost.localdomain [127.0.0.1]
Jul 31 09:11:25 vahdrtvapp05 sendmail[11520]: q6VEBO2a011520: to=cristopher.sh...@va.gov, ctladdr=cristopher.sh...@va.gov (1174/7400), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30359, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q6VEBPPt011524 Message accepted for delivery)
Jul 31 09:11:26 vahdrtvapp05 sendmail[11526]: q6VEBPPt011524: to=<cristopher.sh...@va.gov>, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120631, relay=mailproxy.aac.va.gov [10.238.10.254], dsn=2.0.0, stat=Sent (ok:  Message 49228463 accepted)

When run via jruby as follows:

 java -jar ./lib/jars/jruby-complete-1.6.7.2.jar /tmp/email_test.rb 

There is no output and sendmail's log remains silent.

Environment:  cat /proc/version
Linux version 2.6.18-194.8.1.el5 (mockbu...@x86-006.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Wed Jun 23 10:52:51 EDT 2010


Ruby version 1.8.7 (java)
RubyGems version 1.8.24
Rack version 1.4
Rails version 3.2.5
_javascript_ Runtime therubyrhino (Rhino)
Active Record version 3.2.5
Action Pack version 3.2.5
Active Resource version 3.2.5
Action Mailer version 3.2.5
Active Support version 3.2.5
Middleware

    ActionDispatch::Static
    Rack::Lock
    #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xa205d1>
    Rack::Runtime
    Rack::MethodOverride
    ActionDispatch::RequestId
    Rails::Rack::Logger
    ActionDispatch::ShowExceptions
    ActionDispatch::DebugExceptions
    ActionDispatch::RemoteIp
    ActionDispatch::Reloader
    ActionDispatch::Callbacks
    ActiveRecord::ConnectionAdapters::ConnectionManagement
    ActiveRecord::QueryCache
    ActionDispatch::Cookies
    ActionDispatch::Session::CookieStore
    ActionDispatch::Flash
    ActionDispatch::ParamsParser
    ActionDispatch::Head
    Rack::ConditionalGet
    Rack::ETag
    ActionDispatch::BestStandardsSupport

Application root C:/temp/gem_in_jar/gem_in_jar
Environment development
Database adapter sqlite3
Database schema version
Project: JRuby
Priority: Blocker Blocker
Reporter: Cris Shupp
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to