Do not throw an `ApiException` when grpc logging does not work
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with a PHP sample that uses grpc and the php.ini settings shown, comparing a writable and unwritable grpc.log file. Check the related grpc issue for the upstream behavior; done means the missing or unwritable log is reported descriptively rather than as an ApiException.
Written by the indexing model from the issue text.
Description
When debugging grpc-related issues in a PHP client library, some common steps include adding the below lines to the php.ini file:
grpc.grpc_verbosity=debug
grpc.grpc_trace=all,-timer_check
grpc.log_filename=/var/log/grpc.log
However, if one accidentally forgets to initialize and make the grpc.log file writeable (e.g. running sudo chmod 666 /var/log/grpc.log), then when running any sample PHP code that uses grpc, you get this error:
PHP Fatal error: Uncaught Google\ApiCore\ApiException: {
"message": "failed to connect to all addresses",
"code": 14,
"status": "UNAVAILABLE",
"details": []
}
This is misleading as it suggests that the service one is trying to access in unavailable, when in actuality the only issue is that the grpc.log file is missing/unwriteable.
This error immediately goes away when the grpc.log file is initialized and writeable, or if grpc.log_filename is removed/commented out and the logs are written directly to stderr.
Ideally in this scenario, grpc emits a more descriptive message along the lines of Make sure the grpc.log file is initialized and writeable, and google-cloud-php does not throw an ApiException that could throw off users.
Related issue in grpc here: https://github.com/grpc/grpc/issues/27987
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 464
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 103
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-cloud-php
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
googleapis/google-cloud-php#9730 ·
-
type: feature request
Difficulty 1/5 Under an hour Newbie friendliness 75/100
googleapis/google-cloud-php#9716 · 11 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
googleapis/google-cloud-php#9725 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
googleapis/google-cloud-php#9675 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
googleapis/google-cloud-php#9674 · 1 comment ·
All issues in googleapis/google-cloud-php
Similar issues
-
tooling
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
UX
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·