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

Implement Ice.Trace.Dispatch in C# #3507

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

bernardnormier
Copy link
Member

@bernardnormier bernardnormier commented Feb 5, 2025

This PR implements Ice.Trace.Dispatch in C#.

Sample logging:

-- 2/5/2025 16:42:49:853 Server: Dispatch: dispatch of greet to greeter over ::ffff:127.0.0.1:4061<->::ffff:127.0.0.1:65145 returned a response with reply status Ok
-! 2/5/2025 16:45:58:497 Server: warning: failed to dispatch greet to greeter over ::ffff:127.0.0.1:4061<->::ffff:127.0.0.1:65310:
   Ice.ObjectNotExistException: Dispatch failed with ObjectNotExistException.
      at Ice.Internal.ServantManager.dispatchAsync(IncomingRequest request) in /Users/bernard/builds/ice/csharp/src/Ice/Internal/ServantManager.cs:line 75
      at Ice.Internal.LoggerMiddleware.dispatchAsync(IncomingRequest request) in /Users/bernard/builds/ice/csharp/src/Ice/Internal/LoggerMiddleware.cs:line 24

The message for dispatch exceptions is now different and shorter.

See #3498.

This PR also add a new property, Ice.Warn.Executor (default = 1), which prints warning when the user-installed executor throws exceptions.

{
_instance.initializationData().logger.warning("dispatch exception:\n" + ex);
_instance.initializationData().logger.warning($"executor exception:\n{ex}");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of Ice 3.8, dispatch has the same meaning in Ice and IceRPC: the server-side processing of a request.

{
callback.updated(changes);
}
catch (System.Exception ex)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed this error handling. The user-supplied callback should not throw any exception, and if it does, it will get logged via Ice.Warn.Dispatch / Ice.Trace.Dispatch.

_logger.warning("properties admin update callback raised unexpected exception:\n" + ex);
}
}
// The callback should not throw any exception.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove these deprecated callbacks (for a separate PR).

@bernardnormier bernardnormier merged commit d391326 into zeroc-ice:main Feb 6, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants