首先,我正在使用Linux,
uname -a
输出:
Linux steven-ubuntu 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
我正在带有Windows 7主机,桥接以太网适配器的虚拟机VM内运行,因此我的VM具有自己的IP地址(更改此设置无济于事)。
升级到18.04后,在Java项目中从maven运行liquibase已开始挂在此文件的第54行:
https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/util/NetUtil.java
由以下线程转储确定:
"main" #1 prio=5 os_prio=0 tid=0x00007ff2e8017000 nid=0x1c26 runnable [0x00007ff2effe8000]
java.lang.Thread.State: RUNNABLE
at java.net.Inet6AddressImpl.getHostByAddr(Native Method)
at java.net.InetAddress$2.getHostByAddr(InetAddress.java:932)
at java.net.InetAddress.getHostFromNameService(InetAddress.java:617)
at java.net.InetAddress.getHostName(InetAddress.java:559)
at java.net.InetAddress.getHostName(InetAddress.java:531)
at liquibase.util.NetUtil.getLocalHostName(NetUtil.java:68)
at liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator.<clinit>(LockDatabaseChangeLogGenerator.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at liquibase.sqlgenerator.SqlGeneratorFactory.<init>(SqlGeneratorFactory.java:40)
at liquibase.sqlgenerator.SqlGeneratorFactory.getInstance(SqlGeneratorFactory.java:54)
- locked <0x000000071268dc70> (a java.lang.Class for liquibase.sqlgenerator.SqlGeneratorFactory)
at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:25)
at liquibase.executor.jvm.JdbcExecutor.access$700(JdbcExecutor.java:36)
at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatement(JdbcExecutor.java:338)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:126)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:134)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:142)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:157)
at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:178)
at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:173)
at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:98)
at liquibase.snapshot.SnapshotGeneratorFactory.hasDatabaseChangeLogLockTable(SnapshotGeneratorFactory.java:190)
at liquibase.lockservice.StandardLockService.hasDatabaseChangeLogLockTable(StandardLockService.java:155)
at liquibase.lockservice.StandardLockService.init(StandardLockService.java:91)
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:206)
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:170)
at liquibase.Liquibase.update(Liquibase.java:196)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
- locked <0x0000000712bae3f0> (a java.util.concurrent.ConcurrentHashMap)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
- locked <0x0000000712cb4e08> (a java.lang.Object)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at xxx.xxx.xxx.Application.main(Application.java:13)
当我将NetUtil.java代码放入测试中时,似乎正在发生变化的是docker bridge网络接口作为链接本地返回,并且在{{1上被调用getHostAddress
时挂起大约一分钟}}。
为完整起见,这是我的ifconfig输出的一部分(由于该位是公司网络而不是我自己的,因此已被编辑):
InetAddress
我已经阅读了一些内容,我不确定为什么现在开始发生这种情况,我知道这与使用IPv6且地址以docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:7ff:fe80:e19e prefixlen 64 scopeid 0x20<link>
ether 02:42:07:80:e1:9e txqueuelen 0 (Ethernet)
RX packets 1565847 bytes 230703822 (230.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1652433 bytes 281433074 (281.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xxx.xxx.xx.xxx netmask xxx.xxx.xxx.xxx broadcast xxx.xxx.xx.xxx
inet6 fe80::xxxx:xxxx:xxxx:xxxx prefixlen 64 scopeid 0x20<link>
ether xx:xx:xx:xx:xx:xx txqueuelen 1000 (Ethernet)
RX packets 742756 bytes 342772129 (342.7 MB)
RX errors 0 dropped 8 overruns 0 frame 0
TX packets 188407 bytes 22628920 (22.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 63202450 bytes 8595864135 (8.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 63202450 bytes 8595864135 (8.5 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth1066c1e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::d84e:a5ff:fe2f:13e8 prefixlen 64 scopeid 0x20<link>
ether da:4e:a5:2f:13:e8 txqueuelen 0 (Ethernet)
RX packets 88741 bytes 34594470 (34.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 100019 bytes 13777003 (13.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethaafd38b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::1c5a:71ff:feec:a967 prefixlen 64 scopeid 0x20<link>
ether 1e:5a:71:ec:a9:67 txqueuelen 0 (Ethernet)
RX packets 1135031 bytes 136231703 (136.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1179113 bytes 207949181 (207.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethfb83a40: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::9839:4dff:fe7b:fd1d prefixlen 64 scopeid 0x20<link>
ether 9a:39:4d:7b:fd:1d txqueuelen 0 (Ethernet)
RX packets 292658 bytes 72383959 (72.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 323243 bytes 52972093 (52.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
开头的docker有关,但我不知道在将Ubuntu从16.04升级到18.04之前,知道为什么停滞从未发生过。
我怀疑docker一直使用链接本地地址,但是我的以太网接口fe80::
是Java中enp0s3
进行的本地SIOCGIFCONF ioctl
调用首先列出的。那是对的吗?有人知道为什么会这样吗?我是否应该尝试做一些事情来阻止docker bridge接口驱动程序在NetworkInterface.getNetworkInterfaces()
接口之前加载,以重新排序enp0s3
调用的结果?
通过将SIOCGIFCONF ioctl
IP地址docker0
添加到主机文件中,我已经成功解决了该问题。我怀疑这可行,因为172.17.0.1
调用正在进行反向DNS查找以获取主机名。我对周围的工作不太满意,因为它看起来像是贴膏药,如果有人可以解释为什么会发生这种情况,或者让我知道我需要认真阅读以正确解决此问题,我将不胜感激