-
Notifications
You must be signed in to change notification settings - Fork 79
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
rpcsrv: carefully store Oracle service instance #3085
Conversation
Broken by #3084. Signed-off-by: Anna Shaleva <[email protected]>
The test for the case of disabled Oracle service is added in the #3063. |
9c9d2fe
to
980769a
Compare
This makes |
980769a
to
e4aa13e
Compare
e4aa13e
to
8ae8630
Compare
And simplify atomic service value stored by RPC server. Oracle service can either be an untyped nil or be the proper non-nil *oracle.Oracle. Otherwise `submitoracleresponse` RPC handler doesn't work properly. Signed-off-by: Anna Shaleva <[email protected]>
8ae8630
to
c391537
Compare
oracle := s.oracle.Load().(*OracleHandler) | ||
if oracle == nil || *oracle == nil { | ||
oraclePtr := s.oracle.Load() | ||
if oraclePtr == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Thank you for fixing
Problem
Invalid
submitoracleresponse
RPC handler behaviour in case of disabled Oracle service: noneorpc.NewRPCError("Oracle is not enabled", "")
error is returned. Thanks to @tatiana-nspcc for the report.Solution
Check for typed nil value while setting Oracle service. I know, that we don't want to import the whole
oracle
package from therpcsrv
, but the alternatives I see looks worser to me:rpcsrv.New(...)
is used. It's not very convinient; there are three places in the code and a couple more in tests.rpcsrv
to ensure that Oracle service is really nil. We'd better avoid reflection untill there are no other choices.