I have a java program that runs inside a docker container.
This program tries to connect to a Ipv4 socket.
I get the following Invalid argument exception
Caused by: java.net.SocketException: Invalid argument: /135.250.15.104:6524
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:209)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:199)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1089)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.handler.ssl.SslHandler.connect(SslHandler.java:415)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:914)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:208)
at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
Now I have tried setting -Djava.net.preferIPv4Stack=true JVM option, but no luck.
I am using open-jdk 8 and from java:openjdk-8u72-jre is the entry in my DockerFile .
Note that the same IP address is ping-able from the docker container.
The problem was solved when I used --net=host see docker reference in my docker run command and network_mode : "host" in my docker-compose file see compose reference.
Also see a related stackoverflow post.
The problem seems to get exposed only when the socket connection uses a per-defined local socket address instead of letting the NIO choose a free local address.
But the exception stack trace says "Invalid argument" for the remote address which kind of is weird and that is why it took time for me to figure out the problem.
Related
during OpenShift installation from a local mirror registry, after I started the bootstrap machine i see the following error in the journal log:
release-image-download.sh[1270]:
Error: error pulling image "quay.io/openshift-release-dev/ocp-release#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129":
unable to pull quay.io/openshift-release-dev/ocp-release#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129: unable to pull image:
Error initializing source docker://quay.io/openshift-release-dev/ocp-release#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129:
(Mirrors also failed: [my registry:5000/ocp4/openshift4#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129: Error reading manifest
sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129 in my registry:5000/ocp4/openshift4: manifest unknown: manifest unknown]):
quay.io/openshift-release-dev/ocp-release#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129: error pinging docker registry quay.io:
Get "https://quay.io/v2/": dial tcp 50.16.140.223:443: i/o timeout
Does anyone have any idea what it can be?
The answer is here in the error:
... dial tcp 50.16.140.223:443: i/o timeout
Try this on the command line:
$ podman pull quay.io/openshift-release-dev/ocp-release#sha256:999a6a4bd731075e389ae601b373194c6cb2c7b4dadd1ad06ef607e86476b129
You'll need to be authenticated to actually download the content (this is what the pull secret does). However, if you can't get the "unauthenticated" error then this would more solidly point to some network configuration.
That IP resolves to a quay host (you can verify that with "curl -k https://50.16.140.223"). Perhaps you have an internet filter or firewall in place that's blocking egress?
Resolutions:
fix your network issue, if you have one
look at doing an disconnected /airgap install -- https://docs.openshift.com/container-platform/4.7/installing/installing-mirroring-installation-images.html has more details on that
(If you're already doing an airgap install and it's your local mirror that's failing, then your local mirror is failing)
When I join another host machine as a worker to my swarm the log gives me this error
ERRO[2021-05-06T16:27:16.208574765+07:00] Could not open netlink handle during vni population for ns /var/run/docker/netns/1-p0wju48aad: failed to set into network namespace 21 while creating netlink socket: invalid argument
How to solve this guys?
Well this error could just a random error in my VM for no reason so this could be ignored
I am using windows 10 professional and I have installed docker using DockerToolBox, so I have a docker-machine running in VirtualBox. When trying to configure an interpreter in PyCharm using my docker-machine, I get the following error:
"Cannot connect: java.lang.NullPointerException: uri was not specified"
docker-machine error
When I choose 'TCP socket', I get the following error which is different from above:
"Cannot connect: java.io.IOException: Channel disconnected before any data was received"
TCP socket error
I am sure my docker-machine is running because I can connect to it using terminal tools like MobaXterm or XShell, and I can also connect to MySQL running in my docker-machine.
Replacing tcp:// by https:// in the api url works for me in Webstorm (Windows 8.1).
https://github.com/kubernetes/minikube/issues/580
I have tried thousands of methods, and finally resolved this problem. The solution is running pycharm as administrator. WTF
I have same issue.
You must check Pycharm logs. There is detailed information about error.
In my case Pycharm shows same error "Channel disconnected before any data was received".
But in logs i found that error is caused by:
"ERROR - HttpResponseStreamHandlerFixed - exceptionCaught before first read or disconnect, we may be hanging
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: No name matching "my_server_hostname" found"
In my case, the problem was that domain name that i connecting to is in not the same as hostname in SSL self signed cert installed in dockerd.
Domain name that you are connecting to must match domain name in SSL cert that dockerd uses.
I have to make hosts record (C:\Windows\System32\drivers\etc\hosts on Windows, and /etc/hosts on Linux) and connect to it.
And "https://" protocol is required :)
PS. You can check SSL cert hostname by opening Chrome browser to the docker API endpoint with https and opening certificate details.
I have a really strange problem connecting to a Neo4j instance running in a docker instance. But first things first, here is my set up:
Everything runs on a MacOS. I use boot2docker, so the actual Docker instances run in a VirtualBox. I am able to reproduce this issue with Neo4j 2.1.5 and with Neo4j 2.2.0-M04.
Additionally, I installed Neo4j locally via homebrew and it is version 2.1.7. It is installed to have a neo4j-shell available.
The docker instances are accessible from the outside via 192.168.59.104. The docker instance itself has a 172.17.0.x IP address.
The problem:
I try to connect with neo4j-shell like this: neo4j-shell -v -host 192.168.59.104 -port 1337 -name shell. After a couple of minutes, it fails with:
ERROR (-v for expanded information):
Connection refused
java.rmi.ConnectException: Connection refused to host: 172.17.0.2; nested exception is:
java.net.ConnectException: Operation timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at com.sun.proxy.$Proxy1.welcome(Unknown Source)
at org.neo4j.shell.impl.AbstractClient.sayHi(AbstractClient.java:215)
at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:63)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:55)
at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:43)
at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:165)
at org.neo4j.shell.StartClient.startRemote(StartClient.java:297)
at org.neo4j.shell.StartClient.start(StartClient.java:175)
at org.neo4j.shell.StartClient.main(StartClient.java:120)
Caused by: java.net.ConnectException: Operation timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 14 more
The interesting part is, that it fails by trying to connect 172.17.0.2 instead of the provided IP address.
What I did so far:
Double check neo4j.properties are correct
remote_shell_host=0.0.0.0 is set
remote_shell_port=1337 is set
check the ports are exposed properly with docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
099cfd1b8018 daneroo/neo4j:latest "/bin/bash -c /launc 3 minutes ago Up 3 minutes 0.0.0.0:1337->1337/tcp, 0.0.0.0:7474->7474/tcp neo4j
Some Google and SO searches, but without any success.
Different neo4j versions and docker images
Basic connection checks with telnet 192.168.59.104 1337. This is successful.
Catch up with Mark Needham at todays neo4j meetup
So, do I miss something? In theory this should happen every time you can access the Neo4j through another IP address than the Neo4j instance can see (e.g. if you run a Neo4j instance at home on a machine with the IP 192.168.x.y and you try to access it via your public IP you have at this time).
Where is the client, running outside the Neo4j environment, getting the internal IP address from? Is there a way to work around this issue?
I think it might be related to the RMI protocol that the shell uses to communicate with Neo4j.
Afaik RMI also uses some additional ports and it might redirect the initial request. there is a system property in Java that you might want to try to set in neo4j-wrapper.conf: -Djava.rmi.server.hostname=192.168.59.104
see:
http://courses.cs.washington.edu/courses/cse341/98au/java/jdk1.2beta4/docs/guide/rmi/rmiNetworkingFAQ.html
http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/javarmiproperties.html
I am totally new to Cassandra and met the following error when using cqlsh:
cqlsh
Connection error: Could not connect to localhost:9160
I read the solutions from the following link and tried them all. But none of them works for me.
How to connect Cassandra to localhost using cqlsh?
I am working on CentOS6.5 and installed Cassandra2.0 using yum intall dsc20.
I ran into the same issue running the same OS and same install method. While the cassandra service claims that it's starting ok, if you run service cassandra status it would tell me that the process was dead. Here are the steps I took to fix it:
Viewing the log file at /var/log/cassandra/cassandra.log gave told me that my heap size was too small. Manually set the heap size in /etc/cassandra/conf/cassandra-env.sh:
MAX_HEAP_SIZE="1G"
HEAP_NEWSIZE="256M"
Tips on setting the heap size for your system can be found here
Next, the error log claimed the stack size was too small. Once again in /etc/cassandra/conf/cassandra-env.sh find a line that looks like JVM_OPTS="$JVM_OPTS -Xss128k" and raise that number to JVM_OPTS="$JVM_OPTS -Xss256k"
Lastly, the log complained that the local url was misformed and threw a java exception. I found the answer to the last part here. Basically, you want to manually bind your server's hostname in your /etc/hosts file.
127.0.0.1 localhost localhost.localdomain server1.example.com
Hope this helps~
Change:
/etc/cassandra/cassandra.yaml
Whether to start the thrift rpc server.
start_rpc: false
to
start_rpc: true