-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
spring-boot-devtools java.net.SocketException: Unexpected end of file from server #10317
Comments
@evgeniycheban I did the same using version |
@evgeniycheban I second Eddu here. For a start, it would be nice to see if you can reproduce this outside of Docker. |
@snicoll outside of Docker everything works fine. @eddumelendez using 1.5.7.RELEASE I'm getting the same result. |
@evgeniycheban Spring Boot doesn't do anything special in a Docker environment and it expects the network to function as it would elsewhere. Can you please explain why you think this is a problem with Spring Boot rather than Docker? |
@wilkinsona I tried to run |
@evgeniycheban I put the
Then, perform the following commands to build the image and run the container. Ensure you are exposing the port 8080 or whatever you are using
|
It seems that this error occurs only if I running it from Intellij IDEA I tried to run it from Eclipse and everything works well now. |
@evgeniycheban Thanks for the update. Boot doesn't doing anything special when running in IDEA vs Eclipse. I'm going to close this one as there's no evidence at this stage that it's a problem with Boot. |
@wilkinsona ok thank you. |
@evgeniycheban Did you ever figure this out? I have the exact same issue using IDEA to run the RemoteSpringApplication and connecting to a Boot app running inside a Docker container. I'm using Docker Compose and running on a Mac. |
@steveratay No I didn't find any solution. I'm also having this issue in Eclipse, but it happens very rarely. I think it's Docker's issue because I tried to update app running on the VPS server and it works fine. |
@evgeniycheban @wilkinsona I am also having the same issue. Did some additional testing and it appears to be caused by dockers bridge networking. When running the container on the host network it works fine. When its behind the bridge it looks like the stream is being cut pre-maturely and the exception "java.net.SocketException: Unexpected end of file from server" is being thrown as it would. Thanks, |
@alexIsAtGitHub Thanks for the analysis. Spring Boot isn’t doing any tunnelling in this scenario. It’s a normal HTTP connection to the application so there’s no custom network code involved on Boot’s side. |
Hey @wilkinsona thanks for replying. Yes
sorry you are correct I was getting mixed up with the remote debugging I
was also trying to also get working at 1am. Is Spring devtools just piggy
backing on the tomcat server port specified at launch?
The error that was reported by @evgeniycheban appears to be related to docker exposing
the port without dev tools being wired up to it. The port must be held open
by docker but nothing on the other end to respond? At least that seems to
be the case.
…On Tue, Oct 31, 2017 at 4:56 AM, Andy Wilkinson ***@***.***> wrote:
@alexIsAtGitHub <https://github.com/alexisatgithub> Thanks for the
analysis. Spring Boot isn’t doing any tunnelling in this scenario. It’s a
normal HTTP connection to the application so there’s no custom network code
involved on Boot’s side.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10317 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Afs_-rRaVsdToAupVGKwTKIu6ncowhjOks5sxsungaJpZM4PZ7VI>
.
|
Yes, that's right. It's just a plain HTTP connection made to Tomcat (or Jetty or Undertow). |
@wilkinsona ok good to know, I have it working now. @evgeniycheban & @steveratay I did manage to get this working properly after receiving the same error as you. Dev tools either isn't loaded inside docker or you're trying to connect to the incorrect port with your remote session. Check your output from docker when starting the spring boot application and verify that the port its bound to is the same one you are trying to reference in your remote session. Spring Remote is piggy backing on the existing tomcat http socket. |
I all, I've the same issue reported above; I'm using Spring Boot 1.5.8.BUILD-SNAPSHOT. This is the docker file: FROM java:8 and i run the docker container with the -p 8080:8080 argument. Exception in thread "File Watcher" java.lang.IllegalStateException: java.net.SocketException: Unexpected end of file from server The bytecode change is published but the RemoteSpringApplication dies. TIA and regards. |
@fabietto1975 As far as we know, this is an issue with Docker's networking. If you have evidence that suggests it's Spring Boot that's at fault, please share it and we'll take a look. |
The problem for me appears to be that the application I am trying to reload dies with a Logs from IntelliJ:
Logs from remote application:
|
@steveratay That's usually a sign that the classloader split is incorrect. From the stacktrace above It looks like you have a |
I tried adding a |
A bit of a twist in my case. My app has the main app running on port 8082, and the admin section running on port 8081. When I configure SpringRemoteApplication against 8082 (via an IntelliJ run/debug config using "http://localhost:8082" as the "Program arguments:") and change a class that runs on 8082 (the app runs fine using both these ports), I get this error upon Rebuilding. I have both 8081 and 8082 exposed in docker-compose.yml. (As well as 50505 for debugger purposes.) If I reconfigure to run the entire app to run only on 8081 and configure SpringRemoteApplication to use 8081, but with the same ports exposed, I still get the same problem. But if I turn off the port exposure for 8082 in docker-compose-yml, the problem goes away. (Note that 50505 is still turned on.) I verified this a few times. App only runs on 8081, SpringRemoteApplication is configured against 8081, 8081 is exposed. If 8082 is exposed, it stops working. If it is unexposed, it starts working again. Same docker image, just an altered docker-compose config. Finally, if I go back to using two ports, but instead of using 8081 and 8082, I use 8081 and 9082, then everything works fine. So, I've either discovering something really special about port 8082 either with devtools or with docker, or I've got some kind of idiosyncrasy on my own system, perhaps another running container somewhere that is listening for that port. lsof doesn't show anything, but I could be missing something. I guess the moral of the story is to try changing the ports in your configs and see if the problem goes away. |
Thanks for the analysis, @tunesmith. There's nothing special in DevTools for port 8082. It just uses HTTP over whatever port you tell it to use. I would guess, but it is really just a guess, that this is an oddity of docker or your own system. |
Digging this issue up for people who still encounter this. |
I am having the same issue with my Docker environment, using Spring Boot 2.0.1, Docker 18.06 on Ubuntu 18.04 x64, IntelliJ IDEA 18.2.2 with Gradle. It would be nice if the FileWatcher capability wouldn't die in RemoteSpringApplication even if there is a networking error. This may happen not only with Docker but for any reason, say a short-lived networking outage between the remote Spring Boot application and the client proxy application. Currently, if there is a networking error like the above, RemoteSpringApplication stops watching for the filesystem and no updates ill be sent to the remote app. I can confirm that using the container IP works properly. If I connect via the container IP, there is no error and I can submit code changes repeatedly. |
We added some retry logic for connection failures in b1dd928. That should cover the majority of cases where there's a network outage. When the server returns an incomplete or empty response, I'm not completely sure that carrying on or retrying would be the right thing to do as we don't know what state things are in. Piling changes on top may just make things worse. That said, given that this is development-only, perhaps carrying on as best we can is the better option. The app can always be stopped and restarted if things get in a mess. |
We're going to broaden the retry. |
I have an issue to reload my app running inside docker container using
spring-boot-devtools:1.5.6.RELEASE
When I connect to the remote app with
org.springframework.boot.devtools.RemoteSpringApplication
and do some changes then after my changes were uploaded I'm getting:java.net.SocketException: Unexpected end of file from server
I tried to get it work on my Mac and Linux laptop but the result is always the same. Here is my log:
Maybe it related to #1106
The text was updated successfully, but these errors were encountered: