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

Device with no output / Stack dump. #474

Open
MatthewHink opened this issue Aug 10, 2020 · 2 comments
Open

Device with no output / Stack dump. #474

MatthewHink opened this issue Aug 10, 2020 · 2 comments

Comments

@MatthewHink
Copy link
Contributor

Device.Output is a string.
When GetOutput() unable to map the string to an Output, MakeReading will fail with a stack dump.
When there are currently 882 devices on a VEM-150, the stack dump is insufficient to debug which device is causing trouble.

Possible solution:
a. Check at configuration time that each configured Device.Output maps to a valid Output.
b. Check at runtime during MakeReading for a nil output.
For each case: Log enough information to determine the device and shut down the plugin gracefully.

The repro is basically to create a device with something like Output: "output_does_not_exit"

@MatthewHink
Copy link
Contributor Author

Would not be too surprised if there are similar issues around other string fields in struct Device (worth a look).

@edaniszewski
Copy link
Contributor

I think this is being done at configuration time (or, when devices are loaded from configuration)

synse-sdk/sdk/device.go

Lines 237 to 245 in 64f5771

if instance.Output != "" {
if output.Get(instance.Output) == nil {
log.WithFields(log.Fields{
"prototype": proto,
"instance": instance,
}).Error("[device] unknown output specified")
return nil, fmt.Errorf("new device: unknown output specified '%s'", instance.Output)
}
}

As for whether or not enough info is being logged -- probably not. It looks like it is logging the device instance and device prototype structs, but given that they are pointers, I'm not actually sure its logging anything useful there

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

No branches or pull requests

2 participants