Fix gRPC BoardListWatch crashing when installing/uninstalling a core/lib #1460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.mdhas been updated with a migration guide (for breaking changes)Fixes a bug in the gRPC interface.
Calling one of the following gRPC function:
PlatformInstallPlatformUninstallPlatformUpgradeLibraryInstallLibraryUninstallLibraryUpgradeAllcrashes the
arduino-cli daemonif theBoardListWatchprocess for theinstanceused to call the aforementioned functions is running.Calling one of the following gRPC function:
PlatformInstallPlatformUninstallPlatformUpgradeLibraryInstallLibraryUninstallLibraryUpgradeAllstops the
BoardListWatchprocess for theinstanceused to call the aforementioned functions, the connected clients will be notified theBoardListWatchprocess is quitting.If the client will need to restart the
BoardListWatchprocess it must wait for the above functions to return a response.titled accordingly?
Nope.
This bug is caused by the internal workings of the Arduino CLI daemon.
gRPC clients using the CLI must first
Createa newinstancethat is used to keep track of installed platforms, tools, discoveries and libraries, thatinstanceis populated with data using theInitfunction. Since there can be multiple clients connection via gRPC we might have multipleinstances internally to keep track of.The
Initfunction can also be used on an already initializedinstanceso the first thing we do is "clean" thatinstance, that means also stopping all the pluggable discovery processes that are running, doing that while theBoardListWatchprocess is running causes the bug being fixed by this PR.The best possible solution would have been to notify the
BoardListWatchprocess that the discoveries are quitting and act accordingly by restarting it after the initialization step has finished but that would require a big paradigm change in the internal logic of the CLI that we can't bear as of now, thus this solution.See how to contribute