-
Notifications
You must be signed in to change notification settings - Fork 138
Nailgun client read future was interrupted #112
Comments
Unfortunately this is the way how server shutdown is currently designed - it just interrupts a listener thread by setting its flag to 'interrupted' and catching InterruptedException afterwards. I have plans to refactor it and implement a graceful shutdown. So far you can probably just have java logger configured to suppress com.martiansoftware.nailgun.NGInputStream warnings. |
Thank you for the answer Sergey. I'll try with the logger supression. I think that fixing this at its root would be awesome -- users are confused when they see this stack trace, and they think something's acting up when it's not. |
Should be fixed with 0.9.3 |
@sbalabanov this still seems to be happening in 0.9.3. |
Have log? It might happen if socket did not properly signal termination and Nailgun server has to close itself forcefully. |
Yes, I'm seeing it too.
And this is from the very latest master. |
Can we reopen this? It would be great if this is fixed... 😄. Most of my users run this manually and are scared when they see a stack trace be thrown at them. |
I am not seeing it at least not on mac. Have repro? Yes you can reopen. |
Strange, we have reproduced on mac. I cannot reopen since I don't have contributor rights on the repo. Could you do it for me? |
+1 I can confirm I'm having the same issue:
|
ping @sbalabanov |
I was able to reproduce this issue with the hello world nail. Running it several times makes the server print the stack trace. The reason why this happens is because there is a race condition between the What happens is that, from time to time, to get a heartbeat, I've solved it in a less than ideal way in this patch. The patch forces Nailgun to ignore socket exceptions if Let me know if you want me to PR this change. I've tried it with my application and the stack trace has disappeared completely. |
It seems you are using internet protocol for client-server communication, that's why there is SocketInputStream in the stack. In my test cases, local unix socket was used thus custom NGUnixDomainSocketInputStream as used as an underlying stream. The fix would probably be to rethrow SocketException as EOFException if eof or termination flag is set. |
I’m pretty sure I’m using Unix domain sockets, though. |
Hey guys, I'm not sure if I missing something but I have a very simple and straight forward use case that seems to be degrading with these updates. The implementation goes as below: The sole Nail in the project public class MyNail {
public static void nailMain(NGContext context) {
new MyNail().execute(context.getArgs());
}
} Embedded NG Server in my project's jar public class Main {
private static final NGServer SERVER = new NGServer();
public static void main(String[] args) {
if (SERVER.isRunning()) exit(0);
Main main = new Main();
// Register MyNail
main.registerAliases(SERVER);
SERVER.run();
}
} Shell script I use for invoking NG Python Client NG_CLIENT="ng.py"
NG_SERVER="myproject.jar"
function is_server_offline {
"${NG_CLIENT}" &>/dev/null
# 230 -> could not connect to server
[[ $? == 230 ]] && return 0 || return 1
}
function start_server {
if $(is_server_offline) ;
then
java -jar "$NG_SERVER" & &>/dev/null
sleep 1
fi
}
function process_aliases_command {
start_server
"${NG_CLIENT}" ng-alias
finish_command "" "Unable to parse aliases. Please contact ${OWNERS}"
}
function process_my_nail_call {
start_server
"${NG_CLIENT}" mynail -- ${ARGS}
} Stack trace I get whenever I try to reach my nail
VersionsNG Server: master @sbalabanov , are you suggesting I should handle something different in the server side? |
@jvican you need to use which instantiates NGUnixDomainServerSocket which yields to NGUnixDomainSocketInputStream |
@sbalabanov sorry taking to long to answer. I tested today (ater #132 merged) again using the master version of
Though the command gets executed. I'll see if I can put a simple project where this can be reproduced. |
I've been using in production my fix scalacenter@84605e2 and the error is gone. Sometimes, maybe 1 in 20 times, I get the other following stack trace:
But given the fact it rarely shows up, I can live with it. |
Hi guys, I was having a problem and referencing an old version of ng all. That's why I was still getting the error message. Everything is working as it supposed to now. Thank you very much the help :) |
I'm happy to hear that this is now fixed. I'll update to latest master then and drop my temporary fix. |
Hello, we're using nailgun in bloop: http://github.com/scalacenter/bloop.
We're using latest master for both the server and the python plugin, and we're getting this warning all the time in the server logs (after every executed command).
Why is this happening? How can we make this warning disappear?
The text was updated successfully, but these errors were encountered: