-
Notifications
You must be signed in to change notification settings - Fork 7
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.lang.IllegalStateException: Trying to send a message on a shutdown sender #38
Comments
Ping @missedone |
I tried once before, but can't reproduce, will try a more complicate case later. |
Ok 👍 I've just seen the |
Still can't reproduce the issue with the sample on SO. public void run() {
IMessageSender sender = m_serPort != null
? new SerializedMessageSender(m_host, m_serPort)
: new StringMessageSender(m_host, m_port);
final MessageHub msh = new MessageHub(sender);
msh.setDebug(isDebug());
try {
msh.connect();
// We couldn't do this until now in debug mode since the .xml file didn't exist yet.
// Now that we have connected with the Eclipse client, we know that it created the .xml
// file so we can proceed with the initialization
initializeSuitesAndJarFile();
List<XmlSuite> suites = Lists.newArrayList();
calculateAllSuites(m_suites, suites);
if(suites.size() > 0) {
int testCount= 0;
for(int i= 0; i < suites.size(); i++) {
testCount+= (suites.get(i)).getTests().size();
}
GenericMessage gm= new GenericMessage(MessageHelper.GENERIC_SUITE_COUNT);
gm.setSuiteCount(suites.size());
gm.setTestCount(testCount);
msh.sendMessage(gm);
addListener(new RemoteSuiteListener(msh));
setTestRunnerFactory(new DelegatingTestRunnerFactory(buildTestRunnerFactory(), msh));
super.run();
}
else {
System.err.println("No test suite found. Nothing to run");
}
}
catch(Throwable cause) {
cause.printStackTrace(System.err);
}
finally {
// Nick: shutdown here
msh.shutDown();
if (! m_debug && ! m_dontExit) {
System.exit(0);
}
}
} in JsonMessageSender, it check the status: public void sendMessage(IMessage message) throws Exception {
if (m_outStream == null) {
// Nick: I think that's fine here
// or, probably, we can just print a warning message, and return quietly.
throw new IllegalStateException("Trying to send a message on a shutdown sender");
}
synchronized (m_outStream) {
p("Sending message " + message);
...
}
} |
Ok for the IllegalStateException which seems to be expected. testng-remote/remote/src/main/java/org/testng/remote/strprotocol/JsonMessageSender.java Line 37 in efd6691
|
well, I think, yes, there is a time window that synchronized (m_outStream) {
p("Sending message " + message);
// Nick: double check here
if (m_outStream != null) {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(m_outStream, "UTF-8"));
JsonWriter writer = new JsonWriter(bw);
writeMessage(writer, message);
bw.newLine();
bw.flush();
waitForAck();
}
} |
Ok.And what about? synchronized (m_outStream) {
if (m_outStream == null) {
throw new IllegalStateException("Trying to send a message on a shutdown sender");
}
p("Sending message " + message);
... Do you see any drawbacks? |
|
oh! right! |
I think we can just leave it for now (keep the ticket open), see if this will happen again with the upstream fix merged. |
👍 |
Hi there, I'm still this exception, can you help out? |
@laurafchen do you have any project to share that shows the issue? Could you share your Eclipse version and the version if its plugins ? |
From http://stackoverflow.com/q/40296350/4234729
The text was updated successfully, but these errors were encountered: