0
I am working on moving our Laravel 5.1 project to Google Compute Engine and I am running into an issue with logging. Specifically the Google Cloud Core package and semaphore permissions.
Infra:
- CentOS 7
- Nginx
- PHP-FPM 7.1
Here is the stacktrace:
2019/05/30 17:30:43 [error] 5901#0: *118 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ErrorException: sem_get(): failed for key 0x41013206: Permission denied in /app/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php:71
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'sem_get(): fail...', '/app/vendor/goo...', 71, Array)
#1 /app/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php(71): sem_get(1090597382, 1, 511, 1)
#2 /app/vendor/google/cloud-core/src/Batch/BatchRunner.php(65): Google\Cloud\Core\Batch\SysvConfigStorage->__construct()
#3 /app/vendor/google/cloud-core/src/Batch/BatchTrait.php(202): Google\Cloud\Core\Batch\BatchRunner->__construct()
#4 /app/vendor/google/cloud-logging/src/PsrLogger.php(150): Google\Cloud\Logging\PsrLogger->setCommonBatchProperties(Array)
#5 /app/vendor/google/cloud-logging/src/LoggingClient.php(575): Google\Cloud\Logging\PsrLogger->__construct(Object(Google\Cloud\Logging\Logger), NULL, Array)
#6 /app/vendor/tylerr92/laravel-stackdriver/src/StackdriverExcep...
PHP message: PHP Fatal error: Uncaught ErrorException: sem_get(): failed for key 0x41013206: Permission denied in /app/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php:71
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'sem_get(): fail...', '/app/vendor/goo...', 71, Array)
#1 /app/vendor/google/cloud-core/src/Batch/SysvConfigStorage.php(71): sem_get(1090597382, 1, 511, 1)
#2 /app/vendor/google/cloud-core/src/Batch/BatchRunner.php(65): Google\Cloud\Core\Batch\SysvConfigStorage->__construct()
#3 /app/vendor/google/cloud-core/src/Batch/BatchTrait.php(202): Google\Cloud\Core\Batch\BatchRunner->__construct()
#4 /app/vendor/google/cloud-logging/src/PsrLogger.php(150): Google\Cloud\Logging\PsrLogger->setCommonBatchProperties(Array)
#5 /app/vendor/google/cloud-logging/src/LoggingClient.php(575): Google\Cloud\Logging\PsrLogger->__construct(Object(Google\Cloud\Logging\Logger), NULL, Array)
I have tested setting google cloud core to the below permission levels: - 0600 - 0660 - 0777
Of course the last one is not a good idea but even that does not work. When I check the sems I get the below back
------ Semaphore Arrays --------
key semid owner perms nsems
0x41013206 98304 root 600 3
If I remove the sem created by root, everything works fine until I reboot. New sems are created with the correct permissions as expected.
I am not very familiar with semaphore, is it possible that I need to adjust something in CentOS for Nginx, or PHP-FPM? Any advice or help would be great.