Skip to content
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

JBEAP-20756 #515

Merged
merged 3 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/main/java/org/jboss/ejb/_private/Logs.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,34 @@ public interface Logs extends BasicLogger {
@Message(id = 516, value = "Exception resolving class %s for unmarshalling; it has either been blacklisted or not whitelisted")
InvalidClassException cannotResolveFilteredClass(String clazz);

@LogMessage(level = WARN)
@Message(id = 517, value = "Exception occurred when writing EJB transaction response to invocation %s over channel %s")
void ioExceptionOnTransactionResponseWrite(int invId, Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 518, value = "Exception occurred when writing EJB transaction recovery response for invocation %s over channel %s")
void ioExceptionOnTransactionRecoveryResponseWrite(int invId, Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 519, value = "Exception occurred when writing EJB response to invocation %s over channel %s")
void ioExceptionOnEJBResponseWrite(int invId, Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 520, value = "Exception occurred when writing EJB session open response to invocation %s over channel %s")
void ioExceptionOnEJBSessionOpenResponseWrite(int invId, Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 521, value = "Exception occurred when writing proceed async response to invocation %s over channel %s")
void ioExceptionOnProceedAsyncResponseWrite(int invId, Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 522, value = "Exception occurred when writing EJB cluster message to channel %s")
void ioExceptionOnEJBClusterMessageWrite(Channel channel, @Cause IOException e);

@LogMessage(level = WARN)
@Message(id = 523, value = "Exception occurred when writing module availability message, closing channel %s")
void ioExceptionOnModuleAvailabilityWrite(Channel channel, @Cause IOException e);

// Remote messages; no ID for brevity but should be translated

@Message(value = "No such EJB: %s")
Expand Down
45 changes: 25 additions & 20 deletions src/main/java/org/jboss/ejb/protocol/remote/EJBServerChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private void writeTxnResponse(final int invId, final int flag) {
PackedInteger.writePackedInteger(os, flag);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB transaction response write failed", e);
Logs.REMOTING.ioExceptionOnTransactionResponseWrite(invId, channel, e);
}
}

Expand All @@ -287,7 +287,7 @@ private void writeTxnResponse(final int invId) {
os.writeBoolean(false);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB transaction response write failed", e);
Logs.REMOTING.ioExceptionOnTransactionResponseWrite(invId, channel, e);
}
}

Expand Down Expand Up @@ -386,7 +386,7 @@ void handleTxnRecoverRequest(final int invId, final MessageInputStream message)
marshaller.finish();
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB transaction response write failed", e);
Logs.REMOTING.ioExceptionOnTransactionRecoveryResponseWrite(invId, channel, e);
}
}

Expand Down Expand Up @@ -522,8 +522,9 @@ private void writeFailedResponse(final int invId, final Throwable e) {
marshaller.writeByte(0);
marshaller.finish();
} catch (IOException e2) {
e2.addSuppressed(e);
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e2);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e2);
}
}

Expand Down Expand Up @@ -571,7 +572,7 @@ public void writeNoSuchEJB() {
os.writeUTF(message);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -595,7 +596,7 @@ public void writeWrongViewType() {
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -607,7 +608,7 @@ public void writeCancelResponse() {
os.writeShort(invId);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -621,7 +622,7 @@ public void writeNotStateful() {
os.writeUTF(message);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand Down Expand Up @@ -657,8 +658,9 @@ protected void writeFailure(Exception reason) {
marshaller.writeByte(0);
marshaller.finish();
} catch (IOException e) {
e.addSuppressed(reason);
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand Down Expand Up @@ -768,7 +770,7 @@ public void convertToStateful(@NotNull final SessionID sessionId) throws Illegal
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB session open response write failed", e);
Logs.REMOTING.ioExceptionOnEJBSessionOpenResponseWrite(invId, channel, e);
}
}
}
Expand Down Expand Up @@ -1009,7 +1011,7 @@ public void writeInvocationResult(final Object result) {
os.close();
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -1030,7 +1032,7 @@ public void writeProceedAsync() {
os.writeShort(invId);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB async response write failed", e);
Logs.REMOTING.ioExceptionOnProceedAsyncResponseWrite(invId, channel, e);
}
}

Expand All @@ -1047,7 +1049,7 @@ public void writeNoSuchMethod() {
os.writeUTF(message);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -1061,7 +1063,7 @@ public void writeSessionNotActive() {
os.writeUTF(message);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
}
Expand All @@ -1086,7 +1088,7 @@ void writeCancellation() {
os.writeShort(invId);
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB response write failed", e);
Logs.REMOTING.ioExceptionOnEJBResponseWrite(invId, channel, e);
} finally {
invocations.removeKey(invId);
} else {
Expand Down Expand Up @@ -1234,7 +1236,7 @@ public void clusterTopology(final List<ClusterInfo> clusterInfoList) {
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB cluster message write failed", e);
Logs.REMOTING.ioExceptionOnEJBClusterMessageWrite(channel, e);
}
}

Expand All @@ -1248,7 +1250,7 @@ public void clusterRemoval(final List<String> clusterNames) {
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB cluster message write failed", e);
Logs.REMOTING.ioExceptionOnEJBClusterMessageWrite(channel, e);
}
}

Expand Down Expand Up @@ -1278,7 +1280,7 @@ public void clusterNewNodesAdded(final ClusterInfo clusterInfo) {
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB cluster message write failed", e);
Logs.REMOTING.ioExceptionOnEJBClusterMessageWrite(channel, e);
}
}

Expand All @@ -1297,7 +1299,7 @@ public void clusterNodesRemoved(final List<ClusterRemovalInfo> clusterRemovalInf
}
} catch (IOException e) {
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB cluster message write failed", e);
Logs.REMOTING.ioExceptionOnEJBClusterMessageWrite(channel, e);
}
}

Expand Down Expand Up @@ -1332,8 +1334,11 @@ private void doWrite(final boolean available, final List<EJBModuleIdentifier> mo
os.writeUTF(distinctName == null ? "" : distinctName);
}
} catch (IOException e) {
// we need to close connection, as module availability messages occurs when establishing a connection to the server
// prior to sending an invocation request (this will prevent a frozen client at the other side)
channel.closeAsync();
// nothing to do at this point; the client doesn't want the response
Logs.REMOTING.trace("EJB availability message write failed", e);
Logs.REMOTING.ioExceptionOnModuleAvailabilityWrite(channel, e);
}
}
}
Expand Down