couchbase / couchbase/couchbase-php-client
Forked Process Hanging Forever When Logging is Enabled
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 7
- Forks
- 13
- Avg merge
- 6d 10m
- Merged PRs (30d)
- 2
Description
When logging is enabled in the Couchbase PHP SDK v4, a forked process hangs indefinitely. However, when logging is disabled, the process runs successfully and exits as expected.
Steps to reproduce the issue: https://github.com/deminy/couchbase-issues/tree/couchbase4/issue-8
Test code used:
<?php
/**
* The test script creates a child process that waits for 5 seconds and then exits.
*
* Usage:
* # When logging is disabled, the script runs successfully:
* docker compose exec -ti app php -d couchbase.log_level= ./test.php
*
* # When logging is enabled, the script hangs indefinitely:
* docker compose exec -ti app php -d couchbase.log_level=warning ./test.php
*/
declare(strict_types=1);
$pid = pcntl_fork();
if ($pid === -1) {
echo 'Could not fork.', PHP_EOL;
exit(1);
}
if ($pid === 0) {
echo 'I am the child (pid: ' . posix_getpid() . ').', PHP_EOL;
sleep(5);
exit(0);
}
echo "I'm the parent.", PHP_EOL;
while (pcntl_wait($status, WNOHANG) === 0) {
sleep(1);
}
echo "Child process #{$pid} has finished execution.", PHP_EOL;
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.
Research direction
Start with the reproduction at https://github.com/deminy/couchbase-issues/tree/couchbase4/issue-8 and run the shown test.php commands with logging disabled and enabled. Trace the fork and logging interaction in the Couchbase PHP SDK. Done means the child exits normally when logging is enabled, while the existing disabled-logging behavior remains successful.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100