Open brusherru opened 2 years ago
When attempting to start smeshing via RPC using an invalid value, an error is logged and returned. When attempting on node start via config, the node crashes.
The rationale is to reduce the likelihood of not noticing the error (not all users will monitor NodeErrorStream
or every log entry). It’s a common practice for a process to crash upon an invalid config value. That's obviously not the case for RPC error handling.
Any other opinions?
Description
In case the User set up a custom (and out of range) value to
smeshing-opts-numunits
field, then the Node just logs an error, and keeps working. (see also #3410).But in case if User specified something invalid into
smeshing-opts-numfiles
— it crashes with the panic:So I believe that we should have the same behavior for both options (and probably others as well), and either crash with a user-friendly message or keep syncing, but log an error and probably send it via NodeError stream.
Steps to reproduce
smeshing-opts-numfiles
to any value greater 1Actual Behavior
It crashes with the error described above.
Expected Behavior
Start the node and start syncing, but log an error and send it via NodeErrorStream.
Previously, I thought that this is OK to panic on startup when smeshing options are not valid. But it will introduce a fork in the logic because it is silly to crash with the panic in the case when the User sends the wrong value to the GRPC endpoint. It is much better to keep Node working, but show an error to the User.
So I think this is the best option. If you have any better ideas — please, write them in the comments below ;)
Environment