Skip to content

Conversation

@alexandrecuer
Copy link
Contributor

in the _log_exception method :

  • all logging should be debug and not error
  • no logging should be thrown if the handler is not running, otherwise cancellation messages are duplicated, we see the first cancellation message at the closing stage and the same is shown when we enter the closed state

this answers to #1110 (reply in thread)

cf #1110 (comment)

this removes the error, when running a TCP server forwarding a serial server :
```
17:10:21 ERROR mixin:113 Please do not use unit=, convert to slave=.
````
ReadRegistersRequestBase cf ResponseBase
in the _log_exception method :  
- all logging should be debug and not error
- no logging should be thrown if the handler is not running, otherwise cancellation messages are duplicated, we see the first cancellation message at the closing stage and the same is shown when we enter the closed state

this answers to #1110 (reply in thread)
def _log_exception(self):
"""Show log exception."""
if not self.running:
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

Log exception can occur before and especially after server is running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The _log_exception() is only called twice, in handle() when self.running is True and in connection_lost(), so always after server is running. But maybe i missunderstand something

Copy link
Collaborator

Choose a reason for hiding this comment

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

_log_exception can be called from anywhere, we add/remove _log_exception often. Apart from that it is not logical nor correct that _log_exception depends on the state of the server.

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@janiversen janiversen merged commit b294096 into pymodbus-dev:dev Oct 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants