-
Notifications
You must be signed in to change notification settings - Fork 144
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
Invalid memory address when using google.longrunning.Operation without operation_info #1399
Comments
I investigated a bit and found something odd. In the function See:
I got this case because I did not put the option syntax = "proto3";
package arjca.prj.v1;
import "google/api/annotations.proto";
import "google/longrunning/operations.proto";
service AwesomeService {
rpc Process(ProcessRequest) returns (google.longrunning.Operation) {
option (google.longrunning.operation_info) = {
response_type: "ProcessResponse"
};
};
}
message ProcessRequest {
}
message ProcessResponse {
} And it works! Still, I think that the behavior with the missing |
Indeed - if we cannot derive the LRO response type, we shouldn't crash, we should just exit. Thanks for the report (and for doing all of that debugging). I'll send a patch |
The utility method that resolves the response type descriptor, handling LROs in the process, can return `nil` if either the response type is not resolvable in the protos (very bad) OR the RPC is an LRO that isn't annotated as required by AIP-151 with `google.longrunning.operation_info`. In these cases, anywhere the helper is used should just exit - if the type is unresolvable there are other issues, and if the LRO RPC is unannotated, then AIP-151 rules will warn on that missing annotation. We definitely shouldn't be going into a `panic` Updates #1399
🤖 I have created a release *beep* *boop* --- ## [1.67.2](https://github.com/googleapis/api-linter/compare/v1.67.1...v1.67.2) (2024-08-14) ### Bug Fixes * **AIP-123:** multiword singleton reduction ([#1417](https://github.com/googleapis/api-linter/issues/1417)) ([7868552](https://github.com/googleapis/api-linter/commit/7868552ff7b27c2fa0f2ff9be3a538763f0450c5)) * **AIP-135:** allow required etag in Delete ([#1414](https://github.com/googleapis/api-linter/issues/1414)) ([aa9587b](https://github.com/googleapis/api-linter/commit/aa9587bc7184a78109f138c809baa00018ea75e9)), refs [#1395](https://github.com/googleapis/api-linter/issues/1395) * **AIP-235:** allow hosting allow_missing ([#1416](https://github.com/googleapis/api-linter/issues/1416)) ([6bfbcdf](https://github.com/googleapis/api-linter/commit/6bfbcdfa8858ccdba98760d76e2d2a757855cc7b)), refs [#1404](https://github.com/googleapis/api-linter/issues/1404) * exit rule if response type cannot be resolved ([#1415](https://github.com/googleapis/api-linter/issues/1415)) ([6874dab](https://github.com/googleapis/api-linter/commit/6874dabb4f0d3503f267bb0ab970d62785d12727)), refs [#1399](https://github.com/googleapis/api-linter/issues/1399) ### Documentation * **AIP-143:** fix rule name used for implementation link ([#1411](https://github.com/googleapis/api-linter/issues/1411)) ([f9cf2eb](https://github.com/googleapis/api-linter/commit/f9cf2ebc9589abfce88317b1e3318a9e1547b41a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Hi,
One method of my Protobuf service is expected to return early, and proceed to computations after the response. Google Cloud guidelines say this method must return a
google.longrunning.Operation
.When following this rule,
api-linter
returns an error:runtime error: invalid memory address or nil pointer dereference
. There is no error if I replacegoogle.longrunning.Operation
bygoogle.protobuf.Empty
, for instance.Stack trace with
--debug
is the following:The error is produced in rule AIP-136 when using a method from
utils
: usingGetResponseType
on thedesc.MethodDescriptor
of the method returninggoogle.longrunning.Operation
returnsnil
.Environment details
Arch Linux x86_64
go1.22.4 linux/amd64
1.66.1
Steps to reproduce
api-linter
returns the error with the following code:I uploaded a repository with this code and dependencies (
googleapis
Protobuf files): https://github.com/arjca/api-linter-bug-longrunning. To reproduce: clone it, fetch the submodule (make init
) and finally runapi-linter
(make lint
).The text was updated successfully, but these errors were encountered: