JRuby

Failing to send mails to msmtp mail server using IO.popen. For instance impossible to send mails to GMail using msmtp. This is a regression.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.x+
  • Fix Version/s: JRuby 1.1RC1
  • Component/s: None
  • Labels:
    None
  • Environment:
    JRuby head. Two weeks ago or now January the 4th. Ubuntu Linux, java version "1.6.0_10-ea"
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Unless you are able to reduce the test by inspecting what is sent by IO.popen, you need to set an msmtp server, for instance to send mails to your gmail account (don't you have a gmail account?). This should be simple.

so apt-get install msmtp.
Then make it work for gmail: edit or creat the .msmtprc file in your home directory and write inside:
account gmail
host smtp.gmail.com
auth on
user your_login@gmail.com
password your_password
tls on
tls_starttls on
tls_certcheck off
from your_login@gmail.com
maildomain gmail.com

Then try this in MRI and then in JRuby (also chekc your mail box):

s = "Date: Fri, 4 Jan 2008 01:00:05 +0100
From: livetribune@gmail.com
To: 'rvalyi@gmail.com' <rvalyi@gmail.com>
Subject: How good is JRuby?
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8

Look at your mail box to discover"

IO.popen("/usr/bin/msmtp -t -C /home/rvalyi/.msmtprc -a gmail --", "w") do |sm|
sm.puts(s.gsub(/\r/, ''))
sm.flush
end

if $? != 0
puts "failed to send mail errno #{$? >> 8}"
end

In MRI you should get nil and receive the e-mail while in JRuby, you would get no email and that error line in your terminal:
failed to send mail errno 143

Ant idea what is going wrong?

Activity

Hide
Stephen Bannasch added a comment -

I think this is related to JRUBY-1857 and JRUBY-1557.

The problem occurs when sending multiple parameters of certain types out through system exec using backtic, ruby's system and IO.popen.

Show
Stephen Bannasch added a comment - I think this is related to JRUBY-1857 and JRUBY-1557. The problem occurs when sending multiple parameters of certain types out through system exec using backtic, ruby's system and IO.popen.
Hide
Thomas E Enebo added a comment -

I am looking at this today...I suspect this will open up a can of popen...

Show
Thomas E Enebo added a comment - I am looking at this today...I suspect this will open up a can of popen...
Hide
Thomas E Enebo added a comment -

Fixed in commit 5500 on trunk. We were unconditionally calling process.destroy which would kill a process in some cases before it had finished.

Show
Thomas E Enebo added a comment - Fixed in commit 5500 on trunk. We were unconditionally calling process.destroy which would kill a process in some cases before it had finished.
Hide
Raphael Valyi added a comment -

Tom,

I'm sorry but it's still not working. You might have fixed something, but then A NEW ISSUE appeared. Now, using the same test, I'm getting an error earlier:
in JRuby heard, I now have in jirb:

irb(main):035:0> IO.popen("/usr/bin/msmtp -t /home/rvalyi/.msmtprc -a gmail", "w") do |sm|
irb(main):036:1* sm.puts("Hello world")
irb(main):037:1> sm.flush
irb(main):038:1> end
Errno::EPIPE: Broken pipe

This is a new issue that wasn't there yesterday. Please mail me or ask me on the irc if you need more details or tests.

Hope this helps.

Show
Raphael Valyi added a comment - Tom, I'm sorry but it's still not working. You might have fixed something, but then A NEW ISSUE appeared. Now, using the same test, I'm getting an error earlier: in JRuby heard, I now have in jirb: irb(main):035:0> IO.popen("/usr/bin/msmtp -t /home/rvalyi/.msmtprc -a gmail", "w") do |sm| irb(main):036:1* sm.puts("Hello world") irb(main):037:1> sm.flush irb(main):038:1> end Errno::EPIPE: Broken pipe This is a new issue that wasn't there yesterday. Please mail me or ask me on the irc if you need more details or tests. Hope this helps.
Hide
Marcin Mielzynski added a comment -

Reopening. Raphael says there's some other issues.

Show
Marcin Mielzynski added a comment - Reopening. Raphael says there's some other issues.
Hide
Stephen Bannasch added a comment -

On my MacOS 10.4.11, Java 1.5.0_13, JRuby trunk system.

This works:

IO.popen("ifconfig 2> /dev/null") {|fd| fd.readlines}

While this doesn't:

IO.popen("/sbin/ifconfig 2> /dev/null") {|fd| fd.readlines}

ifconfig is located at /sbin/ifconfig.

Show
Stephen Bannasch added a comment - On my MacOS 10.4.11, Java 1.5.0_13, JRuby trunk system. This works:
IO.popen("ifconfig 2> /dev/null") {|fd| fd.readlines}
While this doesn't:
IO.popen("/sbin/ifconfig 2> /dev/null") {|fd| fd.readlines}
ifconfig is located at /sbin/ifconfig.
Hide
Raphael Valyi added a comment -

OK, sorry about my last comment: I was wrong the bug is fixed. I had a broken pipe error because my msmtprc file hadn't the correct rights anymore.
So it's fixed.

Stephen, I also see the same bug you mention on my Linux box with JRuby head. Still I believed the bug is different. So we should close this one and track yours elsewhere.
Isn't your bug exactly http://jira.codehaus.org/browse/JRUBY-1557 ? if not, then open an other JIRA.

Regards,

Raphaël Valyi.

Show
Raphael Valyi added a comment - OK, sorry about my last comment: I was wrong the bug is fixed. I had a broken pipe error because my msmtprc file hadn't the correct rights anymore. So it's fixed. Stephen, I also see the same bug you mention on my Linux box with JRuby head. Still I believed the bug is different. So we should close this one and track yours elsewhere. Isn't your bug exactly http://jira.codehaus.org/browse/JRUBY-1557 ? if not, then open an other JIRA. Regards, Raphaël Valyi.
Hide
Thomas E Enebo added a comment -

Fixed per comment

Show
Thomas E Enebo added a comment - Fixed per comment
Hide
Stephen Bannasch added a comment -

Raphael, thanks for the comment.

Your right I think my bug is covered in JRUBY-1557 – though the bug is more general than just dealing with indirection.

I wanted you to be aware just in case some of the problems you were seeing related to those issues.

Show
Stephen Bannasch added a comment - Raphael, thanks for the comment. Your right I think my bug is covered in JRUBY-1557 – though the bug is more general than just dealing with indirection. I wanted you to be aware just in case some of the problems you were seeing related to those issues.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: