-
Notifications
You must be signed in to change notification settings - Fork 882
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
Serial + Async + RTU: Callback is never fired #160
Comments
If you have a working solution could you please raise a PR, so that it could be reviewed and merged if necessary? |
I probably encounter the same problem with long RTU queries. It is not "firing" since client/async.py dataReceived() receives incomplete data. Indeed, serial.Serial is using non blocking timeout=0, so why would we receive the complete packet if it is long... |
I believe with the latest release 1.3.0rc1, the issue should be fixed. Just give a try and update your findings. |
Thanks, however with pymodbus-1.3.0rc1 I encounter the following unhandled error.
|
@wexi do see this error always ? I am not able to reproduce this at my end. Could you give more info regarding your setup ? |
I solved my problem by simplifying/correcting transaction.py processIncomingPacket(self, data, callback). I can't say that I am satisfied: With a given Modbus query the normal response length is known in advance and this information is not utilized. To your question, I am using the Kivy modified twisted reactor. My OS is Ubuntu. Thanks. |
Adding to my previous comment regarding async RTU (improper repacking, a criticism which still stands): To add timeout protection to async RTU we have to addTimeout() to the deferred. As far as async RTU is concerned we are not at RC quality yet. Please fix :-) |
If you think you have a working solution for this issue, could you please
raise a PR ?
ಮೇ 27, 2017 11:36 ಅಪರಾಹ್ನ ರಂದು, "Enoch" <notifications@github.com> ಅವರು
ಬರೆದಿದ್ದಾರೆ:
… Adding to my previous comment regarding async RTU (improper repacking, a
criticism which still stands):
To add timeout protection to async RTU we have to addTimeout() to the
deferred.
addTimeout, when fired, causes a CancelledError response errback.
*It is pymodbus responsibility* then to remove the transaction from its
FifoTransactionManager instance, which it doesn't... bad things then
happen, need I explain?
As far as async RTU is concerned we are not at RC quality yet. Please fix
:-)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#160 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI2OLvgzky8W7GvvJwzcqWIxhhEYfZKmks5r-GY4gaJpZM4NMjPX>
.
|
A proper solution for the addTimeout() bug requires pymodbus to supply a canceller function during the construction of its deferred. This canceller should remove the transaction from the appropriate manager. Since I am only interested in async RTU now I took a shortcut. I leave it for those with write access to this repository (aka the maintainers) to do the hard work. Again, processIncomingPacket(), also requires a rewrite... |
Thanks for the hints. I do not mind adding more contributors to the
project. Let me know if you need write access to the repo. Anyhow, You can
always fork and raise a PR upstream. This is a community driven project and
more helping hands are highly appreciated.
ಮೇ 28, 2017 2:58 ಪೂರ್ವಾಹ್ನ ರಂದು, "Enoch" <notifications@github.com> ಅವರು
ಬರೆದಿದ್ದಾರೆ:
A proper solution for the addTimeout() bug requires pymodbus to supply a
canceller function during the construction of its deferred. This canceller
should remove the transaction from the appropriate manager. Since *I am
only interested in async RTU now* I took a shortcut. I leave it for those
with write access to this repository (aka the maintainers) to do the hard
work.
Again, processIncomingPacket(), also requires a rewrite...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#160 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI2OLn1pGkEB-WalU_b8mc_0CQdjpAvaks5r-JV6gaJpZM4NMjPX>
.
|
@submerged15, @wexi can you share the code that instantiates the async client? Is the reactor running in its own thread? |
You are welcome to examine my 'local' branch: |
Hello, I'm unable to reproduce this problem as of the new If you are still facing this issue, feel free to reopen this and make sure you leave your code excerpts, logs, expected outputs and anything else that can help us track the problem. Thanks :) |
Hi again,
I'm using pymodbus over RS485 with RtuFramer and AsyncModbusProtocol based on the twisted serialport. (Python 2.7)
The callback of the method transaction/ModbusRtuFramer/processIncomingPacket is never fired. In this case the method async/ModbusClientProtocol/_handleresponse.
Workaround: Derivate the ModbusClientProtocol, override the dataReceived method and insert the complete content of the processsIncomingPacket method and replace the callback with the actual method _handleresponse.
The text was updated successfully, but these errors were encountered: