Bug 163650

Summary: Kernel update broke java.net.socket?
Product: [Fedora] Fedora Reporter: Greg Swallow <gswallow>
Component: kernelAssignee: Dave Jones <davej>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: boris, j, noa, pfrields, vnasardinov, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-05 03:56:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Greg Swallow 2005-07-19 20:50:45 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

Description of problem:
Hi,

After yum updated our developers' kernels to 2.6.12, and they rebooted, they could no longer open sockets with Java.  I know nothing about Java or why a kernel would  break it but here are some logs of a maven process which fails:

Attempting to download ai-resin-free-SNAPSHOT.tar.gz.
Error retrieving artifact from [http://office.ai.org/maven/dev/ai-resin-free/tar.gzs/ai-resin-free-SNAPSHOT.tar.gz]: java.net.SocketException: Invalid argument or cannot assign requested address
Error retrieving artifact from [http://office.ai.org/maven/external/ai-resin-free/tar.gzs/ai-resin-free-SNAPSHOT.tar.gz]: java.net.SocketException: Invalid argument or cannot assign requested address
Error retrieving artifact from [http://maven.ai.org/maven/ai-resin-free/tar.gzs/ai-resin-free-SNAPSHOT.tar.gz]: java.net.SocketException: Invalid argument or cannot assign requested address
WARNING: Failed to download ai-resin-free-SNAPSHOT.tar.gz.
Attempting to download opta-SNAPSHOT.jar.
Error retrieving artifact from [http://office.ai.org/maven/dev/opta/jars/opta-SNAPSHOT.jar]: java.net.SocketException: Invalid argument or cannot assign requested address
Error retrieving artifact from [http://office.ai.org/maven/external/opta/jars/opta-SNAPSHOT.jar]: java.net.SocketException: Invalid argument or cannot assign requested address
...

Version-Release number of selected component (if applicable):
kernel-2.6.12-1.1372_FC3 j2sdk-1.4.2_05-fcs

How reproducible:
Always

Steps to Reproduce:
1.  Boot 2.6.12 kernel
2.  Run maven, which uses Java to open sockets, or start Resin, which does the same thing.
3.  It breaks.
4.  Boot 2.6.11 kernel
5.  It works.
  

Additional info:

Comment 1 Ben Stringer 2005-07-26 08:19:24 UTC
I am also seeing this. 

Kernel 2.6.12-1.1372_FC3 with Sun's 1.4.2_03 JDK is unable to open sockets. 

Dropping back to kernel 2.6.11-1.35_FC3 and they work fine.



Comment 2 Ben Stringer 2005-07-26 09:27:30 UTC
I have tried disabling SELinux enforcing - this made no difference.

Here is an strace extract showing the calls immediately prior to the exception
being thrown. The exception seems to be due to incorrect params to the "connect"
call. I'm not sure how to get to the bottom of this - any advise welcome. Is the
http connection using IPv6 where it should be using IPv4?

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("203.63.53.112")}, 16) = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(32777),
sin_addr=inet_addr("192.168.1.100")}, [16]) = 0
close(3)                                = 0
stat64("/usr/local/jdk1.4.2_08-sun/jre/lib/i386/libnet.so",
{st_mode=S_IFREG|0775, st_size=67964, ...}) = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
listen(3, 1)                            = 0
getsockname(3, {sa_family=AF_INET6, sin6_port=htons(32774), inet_pton(AF_INET6,
"::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET6, sin6_port=htons(32774), inet_pton(AF_INET6,
"::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=3213364936}, 24) = -1 EINVAL
(Invalid argument)
close(3)                                = 0
close(4)                                = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(80), inet_pton(AF_INET6,
"::ffff:203.63.53.112", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=3213364936},
24) = -1 EINVAL (Invalid argument)
close(3)                                = 0
write(1, "Web page I/O problem: http://mir"..., 73Web page I/O problem:
http://mirror.bom.gov.au/products/IDR023.loop.shtml) = 73
write(1, "\n", 1
)                       = 1
write(1, "Exception: java.net.SocketExcept"..., 88Exception:
java.net.SocketException: Invalid argument or cannot assign requested address) = 88
write(1, "\n", 1
)                       = 1

Just discovered this appears to be a duplicate of
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=163006

Comment 3 Boris Folgmann 2005-08-24 09:44:28 UTC
I've got the same problem. kernel-2.6.11-1.35_FC3 works, but
kernel-2.6.12-1.1372_FC3 not.

Example: log4j can't send emails via SMTP

log4j:ERROR Error occured while sending e-mail notification.
javax.mail.SendFailedException: Sending failed;
  nested exception is:
    class javax.mail.MessagingException: Could not connect to SMTP host: mail,
port: 25;
  nested exception is:
    java.net.SocketException: Invalid argument or cannot assign requested address
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at org.apache.log4j.net.SMTPAppender.sendBuffer(Unknown Source)
    at org.apache.log4j.net.SMTPAppender.append(Unknown Source)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
    at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
    at org.apache.log4j.Category.callAppenders(Category.java:187)
    at org.apache.log4j.Category.forcedLog(Category.java:372)
    at org.apache.log4j.Category.error(Category.java:303)


Comment 4 Vadim Nasardinov 2005-08-24 15:30:45 UTC
Noa Resare filed a bug with Sun.  See bug 163006, comment #4.

It's a bug in Sun's JVM.  In comment #2, Ben Stringer writes:

 | connect(4, {sa_family=AF_INET6, sin6_port=htons(32774),
 | inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0,
 | sin6_scope_id=3213364936}, 24) = -1 EINVAL

Note that the value of the "addrlen" parameter to "connect" is 24 in
the above call.  It should be 28, because
sizeof(struct sockaddr_in6) is 28.

Comment 5 Noa Resare 2005-08-25 18:35:09 UTC
*** Bug 163006 has been marked as a duplicate of this bug. ***

Comment 6 Noa Resare 2005-08-25 19:03:19 UTC
I've bugged Sun with this once more. The "incident review ID" is 488634. I
suppose that I'll get an answer in a few weeks. 

The workaround that they mention is using -Djava.net.preferIPv4Stack=true, which
fixes my problems.

Comment 7 Archit Shah 2005-08-25 19:54:14 UTC
This bug mirrors bug 164165 in FC4. It has been fixed in CVS.

Comment 8 Dave Jones 2005-08-26 06:10:22 UTC
It should also be fixed in the latest kernel in updates-testing


Comment 9 Ben Stringer 2005-09-01 04:27:16 UTC
The latest FC3 kernel,  2.6.12-1.1376_FC3, fixes this problem for me - thanks!