Skip to content
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

Java app with Microsoft jdbc driver for SQL Server connection failures in WSL #2314

Closed
oulman opened this issue Jul 11, 2017 · 6 comments
Closed
Labels

Comments

@oulman
Copy link

oulman commented Jul 11, 2017

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.15063]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

I have a simple Java app that connects to SQL Server using the Microsoft JDBC Driver. If I try to run the .jar under WSL, I always get an "Connection timed out" exception from the SQL Driver. The same .jar works on the parent Windows 10 machine as well as a standalone Ubuntu 16.04 system.

I have posted an example java app to reproduce here:

https://github.com/oulman/wsl-java-sql-example/

Thanks for your help!

  • What's wrong / what should be happening instead:

Connections time out when running the .jar. Exception from the SQL driver below:

The TCP/IP connection to the host sqlserver, port 1433 has failed. Error: "Connection timed out: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

I took a Wireshark capture on the Windows parent and see what looks like a successful handshake. The client is in blue and server in green.

image

  • Strace of the failing command, if applicable: (If <cmd> is failing, then run strace -o strace.txt -ff <cmd>, and post the strace.txt output here)

execve("/usr/bin/java", ["java", "-jar", "target/wsl_java_sql_example-1.0-"..., "-H", "sqlserver", "-u", "sqllogin", "-p", "password"], [/* 21 vars /]) = 0
brk(NULL) = 0x259a000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45550000
readlink("/proc/self/exe", "/usr/lib/jvm/java-8-openjdk-amd6"..., 4096) = 46
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/tls/x86_64/libjli.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/tls/x86_64", 0x7fffcb1f6590) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/tls/libjli.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/tls", 0x7fffcb1f6590) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/x86_64/libjli.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/x86_64", 0x7fffcb1f6590) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libjli.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 %\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=60256, ...}) = 0
mmap(NULL, 2155416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f44ff0000
mprotect(0x7f9f44ffd000, 2097152, PROT_NONE) = 0
mmap(0x7f9f451fd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x7f9f451fd000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/tls/x86_64", 0x7fffcb1f6560) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/tls", 0x7fffcb1f6560) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/x86_64", 0x7fffcb1f6560) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28140, ...}) = 0
mmap(NULL, 28140, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9f45558000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45540000
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f44c20000
mprotect(0x7f9f44de0000, 2097152, PROT_NONE) = 0
mmap(0x7f9f44fe0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f9f44fe0000
mmap(0x7f9f44fe6000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9f44fe6000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../tls/x86_64", 0x7fffcb1f63f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../tls/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../tls", 0x7fffcb1f63f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../x86_64", 0x7fffcb1f63f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/..", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\35\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=104864, ...}) = 0
mmap(NULL, 2199848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f44a00000
mprotect(0x7f9f44a19000, 2093056, PROT_NONE) = 0
mmap(0x7f9f44c18000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7f9f44c18000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14608, ...}) = 0
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f447f0000
mprotect(0x7f9f447f3000, 2093056, PROT_NONE) = 0
mmap(0x7f9f449f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f9f449f2000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/../libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=138696, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45530000
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f445d0000
mprotect(0x7f9f445e8000, 2093056, PROT_NONE) = 0
mmap(0x7f9f447e7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f9f447e7000
mmap(0x7f9f447e9000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9f447e9000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45520000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45510000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f45500000
arch_prctl(ARCH_SET_FS, 0x7f9f45510700) = 0
mprotect(0x7f9f44fe0000, 16384, PROT_READ) = 0
mprotect(0x7f9f447e7000, 4096, PROT_READ) = 0
mprotect(0x7f9f449f2000, 4096, PROT_READ) = 0
mprotect(0x7f9f44c18000, 4096, PROT_READ) = 0
mprotect(0x7f9f451fd000, 4096, PROT_READ) = 0
mprotect(0x600000, 4096, PROT_READ) = 0
mprotect(0x7f9f45425000, 4096, PROT_READ) = 0
munmap(0x7f9f45558000, 28140) = 0
set_tid_address(0x7f9f455109d0) = 7969
set_robust_list(0x7f9f455109e0, 24) = 0
rt_sigaction(SIGRTMIN, {0x7f9f445d5b50, [], SA_RESTORER|SA_SIGINFO, 0x7f9f445e1390}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f9f445d5be0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9f445e1390}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192
1024, rlim_max=81921024}) = 0
brk(NULL) = 0x259a000
brk(0x25bb000) = 0x25bb000
open("target/wsl_java_sql_example-1.0-SNAPSHOT-jar-with-dependencies.jar", O_RDONLY) = 3
mmap(NULL, 200704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f454c0000
lseek(3, -22, SEEK_END) = 13223013
read(3, "PK\5\6\0\0\0\0\321'\321';m\17\0
W\272\0\0\0", 22) = 22
lseek(3, 12212010, SEEK_SET) = 12212010
read(3, "PK\1\2\24\3\n\0\0\0\0\0\35\210\353J\0\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0"..., 1024) = 1024
lseek(3, 39, SEEK_SET) = 39
read(3, "PK\3\4\24\0\10\0\10\0\34\210\353J\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\0", 30) = 30
munmap(0x7f9f454c0000, 200704) = 0
lseek(3, 89, SEEK_SET) = 89
read(3, "E\215A\16\2020\20\0\357M\372\207~\240\r\204\213\366\6\334LH<ym6t\r\325\245\224."..., 139) = 139
close(3) = 0
readlink("/proc/self/exe", "/usr/lib/jvm/java-8-openjdk-amd6"..., 4096) = 46
access("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libjava.so", F_OK) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/jvm.cfg", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1662, ...}) = 0
read(3, "# Copyright (c) 2003, 2013, Orac"..., 512) = 512
read(3, "ed in the hope that it will be u"..., 512) = 512
read(3, "# Please contact Oracle, 500 Ora"..., 512) = 512
read(3, "upported\n# and may not be availa"..., 512) = 126
read(3, "", 512) = 0
close(3) = 0
stat("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so", {st_mode=S_IFREG|0644, st_size=13738664, ...}) = 0
futex(0x7f9f449f30a8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\316\36\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=13738664, ...}) = 0
mmap(NULL, 15974936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f43690000
mprotect(0x7f9f442e1000, 2097152, PROT_NONE) = 0
mmap(0x7f9f444e1000, 770048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc51000) = 0x7f9f444e1000
mmap(0x7f9f4459d000, 193048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9f4459d000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28140, ...}) = 0
mmap(NULL, 28140, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9f45558000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \235\10\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1566440, ...}) = 0
mmap(NULL, 3675136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f43300000
mprotect(0x7f9f43472000, 2097152, PROT_NONE) = 0
mmap(0x7f9f43672000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x172000) = 0x7f9f43672000
mmap(0x7f9f4367e000, 13312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9f4367e000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1088952, ...}) = 0
mmap(NULL, 3178744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f42ff0000
mprotect(0x7f9f430f8000, 2093056, PROT_NONE) = 0
mmap(0x7f9f432f7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x107000) = 0x7f9f432f7000
close(3) = 0
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/jli/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/../lib/amd64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=89696, ...}) = 0
mmap(NULL, 2185488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9f42dd0000
mprotect(0x7f9f42de6000, 2093056, PROT_NONE) = 0
mmap(0x7f9f42fe5000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f9f42fe5000
close(3) = 0
mprotect(0x7f9f432f7000, 4096, PROT_READ) = 0
mprotect(0x7f9f43672000, 40960, PROT_READ) = 0
mprotect(0x7f9f444e1000, 602112, PROT_READ) = 0
munmap(0x7f9f45558000, 28140) = 0
mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f9f45320000
mprotect(0x7f9f45320000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f9f4541fff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f9f454209d0, tls=0x7f9f45420700, child_tidptr=0x7f9f454209d0) = 7970
futex(0x7f9f454209d0, FUTEX_WAIT, 7970, NULL <unfinished ...>
+++ exited with 1 +++

See our contributing instructions for assistance.

@therealkenc
Copy link
Collaborator

Need:

strace -ff java -jar blah blah 2> jdbctest.strace

Also 10.0.0.0/8 addresses aren't routable.

@oulman
Copy link
Author

oulman commented Jul 11, 2017

strace w/ -ff attached

jdbctest.txt

@therealkenc
Copy link
Collaborator

Appreciate the follow up. Unluckily, there doesn't seem to be any of the usual suspects in there. There is this:

[pid  8315] socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 15
[pid  8315] getsockname(0, 0x7f4eb472db10, 0x7f4eb472db0c) = -1 ENOTSOCK (Socket operation on non-socket)

But I doubt that's important. One thing of note is that it opens an ipv4 socket, and then says 'nah'.

[pid  8315] socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 15
[pid  8315] connect(15, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.241.173.11")}, 16) = 0
[pid  8315] gettimeofday({1499804882, 694762}, NULL) = 0
[pid  8315] poll([{fd=15, events=POLLOUT}], 1, 0) = 1 ([{fd=15, revents=POLLOUT}])
[pid  8315] sendmmsg(15, {{{msg_name(0)=NULL, msg_iov(1)=[{"Q1\1\0\0\1\0\0\0\0\0\0\17server\instance"..., 49}], msg_controllen=0, msg_flags=MSG_DONTROUTE|MSG_DONTWAIT|MSG_FIN|MSG_RST|MSG_NOSIGNAL|MSG_MORE|MSG_FASTOPEN|0x94720010}, 49}, {{msg_name(0)=NULL, msg_iov(1)=[{"\274\216\1\0\0\1\0\0\0\0\0\0\17server\instance"..., 49}], msg_controllen=0, msg_flags=MSG_OOB|MSG_DONTROUTE|MSG_CTRUNC|0x10}, 49}}, 2, MSG_NOSIGNAL) = 2
[... not long after]
[pid  8315] recvfrom(15, "\274\216\201\200\0\1\0\0\0\1\0\0\17server\instance"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.241.173.11")}, [16]) = 110
[pid  8315] close(15)             

What does eventually get opened is ipv6 (at line 40475):

[pid  8315] connect(18, {sa_family=AF_INET6, sin6_port=htons(1433), inet_pton(AF_INET6, "::ffff:10.0.0.1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0

Things kind of look like they go south from there. One suggestion (with no scientific basis whatsoever) would be to configure JDBC to force it to use ipv4. If there is such a thing. That's all I got.

@oulman
Copy link
Author

oulman commented Jul 12, 2017

Thanks for the suggestion. I ran it specifying -Djava.net.preferIPv4Stack=true on the command line which did force it to use ipv4 rather than the ipv4/ipv6 mapped address calls. Same result though.

[pid  4656] connect(18, {sa_family=AF_INET, sin_port=htons(1433), sin_addr=inet_addr("10.0.0.1")}, 16) = 0

I've attached a new strace with the ipv4 stack. 10.0.0.1 is the SQL server. I've got a workaround right now to build in WSL and run in Windows but would love to figure out how to resolve this.

strace-ipv4.txt

Thanks for your help!

@sunilmut
Copy link
Member

@oulman - Thanks for your post and the traces. I looked at the traces but didn't find any suspects, just as @therealkenc. None of the connect calls are timing out. I wonder if non-blocking connect has any role to play here #1829, #1584 et. al because the code does set O_NONBLOCK on the descriptors.
[pid 4656] fcntl(26, F_SETFL, O_RDWR|O_NONBLOCK) = 0

Just for sanity purposes, once you see the connection error failure, can you then double check that your SQL service is still running? Maybe through telnet 10.0.0.1 14331 or by any other means?

@sunilmut
Copy link
Member

Would be good to see if this issue is resolved with 'non-blocking' connect that's available in Fall Creators Update. I am closing the issue out. If it persists, please let us know and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants