Skip to content

grpc empty object when updating the library index #2046

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

Closed
3 tasks done
Bikappa opened this issue Jan 23, 2023 · 1 comment · Fixed by #2057
Closed
3 tasks done

grpc empty object when updating the library index #2046

Bikappa opened this issue Jan 23, 2023 · 1 comment · Fixed by #2057
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project

Comments

@Bikappa
Copy link
Contributor

Bikappa commented Jan 23, 2023

Describe the problem

When using an grpclient to update the library index, command UpdateLibrariesIndex, the download process is ended by and empty object following the "end" message

To reproduce

Start the CLI in deamon mode

arduino-cli daemon

Create an instance (here using the grpcurl tool)

grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Create

Issue an UpdateLibrariesIndex command

grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.UpdateLibrariesIndex

You should observe an output similar to the following

{
 "downloadProgress": {
   "start": {
     "url": "https://downloads.arduino.cc/libraries/library_index.tar.bz2",
     "label": "Downloading index: library_index.tar.bz2"
   }
 }
}
{
 "downloadProgress": {
   "update": {
     "downloaded": "2358123",
     "totalSize": "2358123"
   }
 }
}
{
 "downloadProgress": {
   "end": {
     "success": true
   }
 }
}
{

}

Notice how there's an empty {} object at the bottom

Expected behavior

The message

{
  "downloadProgress": {
    "end": {
      "success": true
    }
  }
}

Closes the stream with no additional objects

Arduino CLI version

commit a58d5ad

Operating system

macOS

Operating system version

13.1 (22C65)

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@Bikappa Bikappa added type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface labels Jan 23, 2023
@Bikappa Bikappa changed the title Empty object when updating the library index grpc empty object when updating the library index Jan 23, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 24, 2023
@cmaglie
Copy link
Member

cmaglie commented Jan 30, 2023

I think it's due to this line:

return stream.Send(&rpc.UpdateLibrariesIndexResponse{})

just returning nil instead of an empty response should be fine.
I guess there are other "streaming" calls that have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants