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

fix(inputs.s7comm): Fix bit queries #14068

Merged
merged 14 commits into from
Nov 13, 2023
Merged

Conversation

phagemann
Copy link
Contributor

@phagemann phagemann commented Oct 9, 2023

resolves #14043

Update Gos7 to allow query of bits. Enforce valid range (0-7).

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Oct 9, 2023
@phagemann phagemann marked this pull request as ready for review October 9, 2023 14:09
@Hipska
Copy link
Contributor

Hipska commented Oct 11, 2023

Do you think it will take long before robinson/gos7 will be patched?

@Hipska Hipska added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Oct 11, 2023
@phagemann
Copy link
Contributor Author

Working on a PR to fix this.
Honestly i am not sure about the time schedule. Maybe a month.

At least 2b34129 is necessary anyway.

@Hipska
Copy link
Contributor

Hipska commented Oct 11, 2023

Can you mark specifically what needs to be reverted when the fix is released upstream?

@phagemann
Copy link
Contributor Author

Both needs to be changed back to 0x01:

"X": 0x01, // Bit

Commit 30a5940 and c28e49b would need to be reverted.

@Hipska
Copy link
Contributor

Hipska commented Oct 11, 2023

Please mark that in the code. (If @srebhan agrees to that)

@powersj powersj removed the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Oct 12, 2023
@srebhan
Copy link
Member

srebhan commented Oct 18, 2023

@phagemann I would love to see this fixed upstream in gos7 and then change this PR to change whatever is necessary (and update the gos7 version). The problem with temporary fixes is that nobody will remove them once they are in. ;-)

Can you fix this upstream? I've created some PRs there and usually they are quick in merging that stuff...

@phagemann
Copy link
Contributor Author

phagemann commented Oct 18, 2023

That's fine with me.

I will do the upstream fix and come back afterwards 😃.

@srebhan srebhan self-assigned this Oct 20, 2023
@powersj
Copy link
Contributor

powersj commented Nov 3, 2023

@phagemann it looks like your upstream issue was closed due to your fix in robinson/gos7#65

Are we good to update the version of s7comm instead of this PR now?

@powersj powersj added the waiting for response waiting for response from contributor label Nov 3, 2023
@Hipska
Copy link
Contributor

Hipska commented Nov 6, 2023

@powersj he stated that the PR would still be needed:

Working on a PR to fix this. Honestly i am not sure about the time schedule. Maybe a month.

At least 2b34129 is necessary anyway.

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Nov 6, 2023
@powersj
Copy link
Contributor

powersj commented Nov 6, 2023

Then the title and commit message need to be updated, @phagemann needs to confirm my original question, and afterwards we can re-review

@powersj powersj added the waiting for response waiting for response from contributor label Nov 6, 2023
@phagemann
Copy link
Contributor Author

@powersj In order to solve this, I need to adjust the MR. Just updating won't work. Shouldn't be much work, but I would like to test it on a real system. If everything works well, I will have one available by the end of the week.

@phagemann it looks like your upstream issue was closed due to your fix in robinson/gos7#65

Are we good to update the version of s7comm instead of this PR now?

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Nov 6, 2023
@phagemann phagemann changed the title fix(inputs.s7comm): Temporary fix to allow querying bits fix(inputs.s7comm): Fix bit queries Nov 6, 2023
@phagemann phagemann marked this pull request as draft November 6, 2023 18:43
Correct Typo.

Co-authored-by: Thomas Casteleyn <[email protected]>
plugins/inputs/s7comm/s7comm.go Outdated Show resolved Hide resolved
@phagemann phagemann marked this pull request as ready for review November 10, 2023 12:31
@GitTurboy
Copy link

GitTurboy commented Nov 10, 2023

Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. Downloads for additional architectures and packages are available below.

👍 This pull request doesn't change the Telegraf binary size

📦 Click here to get additional PR build artifacts

Thank you all, but I found the fix made to resolve【Allow PDU-size to be set as config option】 problem( https://github.com/influxdata/telegraf/pull/14045) were not included

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@phagemann looks good overall, only two minor comments from my side...

plugins/inputs/s7comm/s7comm.go Outdated Show resolved Hide resolved
plugins/inputs/s7comm/type_conversions.go Outdated Show resolved Hide resolved
@GitTurboy
Copy link

GitTurboy commented Nov 12, 2023

I tried to use the last PR(telegraf-1.29.0~92c29c75_windows_amd64) to fetch about 90 items data from a smart 200 PLC, the log shown error message as below:[ I set pdu_size = 200]
[inputs.s7comm] Error in plugin: reading batch 1 failed: CLI : too may items (>20) in multi read/write

@phagemann
Copy link
Contributor Author

phagemann commented Nov 12, 2023

The error message is produced by Gos7. You should not exceed a pdu-size of 20. This is the maximum number of elements contained in a request batch. It does not limit the number of total items. Please try to set set it back to 20 or lower.

I tried to use the last PR(telegraf-1.29.0~92c29c75_windows_amd64) to fetch about 90 items data from a smart 200 PLC, the log shown error message as below:[ I set pdu_size = 200] [inputs.s7comm] Error in plugin: reading batch 1 failed: CLI : too may items (>20) in multi read/write

@GitTurboy
Copy link

The error message is produced by Gos7. You should not exceed a pdu-size of 20. This is the maximum number of elements contained in a request batch. It does not limit the number of total items. Please try to set set it back to 20 or lower.

I tried to use the last PR(telegraf-1.29.0~92c29c75_windows_amd64) to fetch about 90 items data from a smart 200 PLC, the log shown error message as below:[ I set pdu_size = 200] [inputs.s7comm] Error in plugin: reading batch 1 failed: CLI : too may items (>20) in multi read/write

But when I set pdu-size to 20 , the message in log will shown:

2023-11-13T00:19:27Z D! [inputs.s7comm] Reading batch 1...
2023-11-13T00:19:27Z E! [inputs.s7comm] Error in plugin: reading batch 1 failed: CPU : total data exceeds the PDU size

@phagemann
Copy link
Contributor Author

Now your CPU (smart 200) complains about the pdu-size beeing too large. Try lowering it, until the CPU stops reporting this error.

Not sure, whether this is this the right place, as it referring to a already closed issue. It is not relevant for this MR.

@GitTurboy
Copy link

Now your CPU (smart 200) complains about the pdu-size beeing too large. Try lowering it, until the CPU stops reporting this error.

Not sure, whether this is this the right place, as it referring to a already closed issue. It is not relevant for this MR.

Thanks, this method resolved the problem.

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @phagemann!

@srebhan srebhan assigned powersj and unassigned srebhan Nov 13, 2023
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 13, 2023
@powersj powersj merged commit 19c3d26 into influxdata:master Nov 13, 2023
4 checks passed
@github-actions github-actions bot added this to the v1.28.4 milestone Nov 13, 2023
powersj pushed a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inputs.s7comm bit parsing
5 participants