tabish121 commented on code in PR #5597:
URL: https://github.com/apache/activemq-artemis/pull/5597#discussion_r2054423463
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
##########
@@ -490,18 +490,25 @@ private void sendSessionNotification(final
CoreNotificationType type) throws Exc
if (server.getConfiguration().isSuppressSessionNotifications()) {
return;
}
- final TypedProperties props = new TypedProperties();
- if (this.getConnectionID() != null) {
- props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME,
SimpleString.of(this.getConnectionID().toString()));
- }
- props.putSimpleStringProperty(ManagementHelper.HDR_USER,
SimpleString.of(this.getUsername()));
- props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME,
SimpleString.of(this.getName()));
-
- props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID,
SimpleString.of(this.remotingConnection.getClientID()));
- props.putSimpleStringProperty(ManagementHelper.HDR_PROTOCOL_NAME,
SimpleString.of(this.remotingConnection.getProtocolName()));
- props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS,
managementService.getManagementNotificationAddress());
- props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0);
- managementService.sendNotification(new Notification(null, type, props));
+ // Send notification in a new thread to avoid blocking and potentially
soft dead-locking during heavy session open/close
+ sessionExecutor.execute(() -> {
Review Comment:
This likely introduces at least a minor threading issue since
`remotingConnection` can be reassigned during the lifetime of the session which
previously was protected by the locking internally which would now not be the
case. The values read from `remoteingConnection` object could in theory read
from two different instances if the swap occurred partly through the execution
of this code. The fix would be to capture all notification values in local
final variable before sending off the task into the executor to ensure stable
data as that would occur under lock.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact