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

writeInt32 Error / Error Response Not Generated #214

Open
morrisrob opened this issue Dec 12, 2022 · 2 comments
Open

writeInt32 Error / Error Response Not Generated #214

morrisrob opened this issue Dec 12, 2022 · 2 comments
Labels
up for discussion Requires further discussion and agreement before action

Comments

@morrisrob
Copy link

Hello, I recently updated to 3.8.4 (and now 3.9.0). I'm working on some testing and I have run into an issue which looks like it is most likely related to the recent work on integer range checking, etc.

Prior to these changes, if I tried writing a non-integer value, it looks like it would get rounded and still send the value. After these changes, an error is getting generated in the library (which is fine / expected), but no response is getting sent (neither an error response or a rounded value).

I do have my request handler wrapped in a try catch, but it looks like this doesn't help in this situation, since we're already at the point where it is trying to get the response ready and send it out.

I would think that one of 2 things should happen in this case:

  1. Send an error response -or-
  2. Generate an error in the library so that the error can be identified in application logs, but still send along a rounded value to mimic what was done in the past)

I don't necessarily have a preference on either option. Attached is a screenshot of the call stack of this error. Thank you.

image

@markabrahams
Copy link
Owner

Hi @morrisrob - thanks for logging this.

In this case, I'm more inclined to focus on stopping illegal data from entering the MIB - I don't see a good reason to tolerate such antisocial behaviour! :-)

So the two solutions to this end are:
(1) Don't put illegal data in the MIB - it's completely under the caller's control, so they can validate first to avoid this, or
(2) Better, the MIB provider definitions have typing information for scalars and table columns. The library could - and I think should - validate any MIB set/add API call data against the MIB provider types, and fail non-conforming calls.

Thoughts?

@markabrahams markabrahams added the up for discussion Requires further discussion and agreement before action label Dec 14, 2022
@morrisrob
Copy link
Author

@markabrahams Thank you for the response on this. Yes, I agree that this is completely within the caller's control and that the caller should be validating the data first to ensure that it contains legal data. My opening of this issue was based on the fact that the behavior was changed somewhere along the way and that I was surprised that an error was getting generated in the application but it just ended up as a timed out SNMP request.

I've already fixed this on my end by adding some validation and corrected the spot where I was adding an incorrect illegal data to the MIB.

I agree that #2 that you mentioned would be a good solution. Not sure how other users would want to see these types of situations handled, so perhaps adding this as some sort of configurable option or exposing this in a way that it could be caught / handled by the request handler if the user wants to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up for discussion Requires further discussion and agreement before action
Projects
None yet
Development

No branches or pull requests

2 participants