Skip to content

Fix Solaris tests and enable CI#20709

Open
psumbera wants to merge 3 commits intophp:masterfrom
psumbera:github-solaris-ci
Open

Fix Solaris tests and enable CI#20709
psumbera wants to merge 3 commits intophp:masterfrom
psumbera:github-solaris-ci

Conversation

@psumbera
Copy link
Contributor

No description provided.

@devnexen
Copy link
Member

cc @iluuu1994 at least for the CI's aspect.

--SKIPIF--
<?php
if (!function_exists("pcntl_setcpuaffinity")) die("skip pcntl_setcpuaffinity is not available");
if (PHP_OS_FAMILY === 'Solaris') die("skip CPU affinity not supported on Solaris");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the test failing and in which manner ? because as far as I see it is supported by solaris.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails like this:

Running selected tests.
TEST 1/1 [ext/pcntl/tests/pcntl_cpuaffinity.phpt]
========DIFF========
001- bool(true)
002- array(0) {
003- }
004- array(0) {
005- }
006- bool(true)
007- pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) must not be empty
008- pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id invalid value (def)
009- pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id must be between 0 and %d (%d)
010- pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id must be between 0 and %d (-1024)
011- pcntl_getcpuaffinity(): Argument #1 ($process_id) invalid process (-1024)
012- pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) value must be of type int|string, array given
001+ Warning: pcntl_setcpuaffinity(): pset_create: Cannot allocate memory in /root/php-src/ext/pcntl/tests/pcntl_cpuaffinity.php on line 3
002+ bool(false)
003+ 
004+ Warning: pcntl_getcpuaffinity(): pset_create: Cannot allocate memory in /root/php-src/ext/pcntl/tests/pcntl_cpuaffinity.php on line 4
005+ 
006+ Fatal error: Uncaught TypeError: array_diff(): Argument #2 must be of type array, false given in /root/php-src/ext/pcntl/tests/pcntl_cpuaffinity.php:5
007+ Stack trace:
008+ #0 /root/php-src/ext/pcntl/tests/pcntl_cpuaffinity.php(5): array_diff(Array, false)
009+ #1 {main}
010+   thrown in /root/php-src/ext/pcntl/tests/pcntl_cpuaffinity.php on line 5
========DONE========
FAIL pcntl_getcpuaffinity() and pcntl_setcpuaffinity() [ext/pcntl/tests/pcntl_cpuaffinity.phpt] 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test might need adaptation rather than disabling it, pset_create seems to set errno to ENOMEM here. We can devise about it later..

Copy link
Member

@devnexen devnexen Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw do you run it under a VM ? curious also what psrset gives

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw do you run it under a VM ? curious also what psrset gives

Yes, it's VM. When I run test on real machine I get:

========DIFF========
--
     pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id invalid value (def)
     pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id must be between 0 and %d (%d)
     pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) cpu id must be between 0 and %d (-1024)
011- pcntl_getcpuaffinity(): Argument #1 ($process_id) invalid process (-1024)
     pcntl_setcpuaffinity(): Argument #2 ($cpu_ids) value must be of type int|string, array given
========DONE========
FAIL pcntl_getcpuaffinity() and pcntl_setcpuaffinity() [ext/pcntl/tests/pcntl_cpuaffinity.phpt]

I don't see difference in psrset output between VM and real machine. Both give lines like:

processor set SYSpsrset_1 1: empty
..

Copy link
Member

@devnexen devnexen Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that should be largely enough, when I implemented this feature, it I just used a openindiana VM with only 8GB.
That might be swap space issue ; I guess you re really booting a 64 bits kernel.
That would be sad to disable this test just because of particular environment context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, there is something wrong with VM. Another one doesn't have the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one. For now I left it disabled:

TEST 1/1 [ext/pcntl/tests/pcntl_getcpu.phpt]
========DIFF========
     bool(true)
002- int(1)
002+ int(2)
========DONE========
FAIL pcntl_getcpu() [ext/pcntl/tests/pcntl_getcpu.phpt] 

Copy link
Member

@devnexen devnexen Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one issue seems real at first glance, the test should not even launch on solaris/illumos. Is HAVE_SCHED_GETCPU commented in your main/php_config.h ?

Copy link
Contributor Author

@psumbera psumbera Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is (/* #undef HAVE_SCHED_GETCPU */).

# define MIN(x, y) ((x) > (y)? (y) : (x))
#endif

#define SEG_ALLOC_SIZE_MAX 32*1024*1024
Copy link
Member

@devnexen devnexen Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems a slightly unrelated change to me (I do not say it is right or wrong tough).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Solaris, OPcache uses the SysV SHM allocator (shared_alloc_shm.c), which hard-limits individual segments to 32 MB (SEG_ALLOC_SIZE_MAX). With JIT enabled, OPcache reserves a default 64 MB buffer (ZEND_JIT_DEFAULT_BUFFER_SIZE) from the last shared segment during zend_shared_alloc_startup(). This makes startup fail with “Insufficient shared memory!” because the last segment can never satisfy the reservation.

Copy link
Member

@devnexen devnexen Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but what I understood from the comment is opcache on solaris can't work without this change ? If that is the case, this change needs to be a PR on its own as a bug fix (from the lowest branch it needs to apply).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created #20719 .

devnexen added a commit that referenced this pull request Dec 24, 2025
trusting the call to handle invalid process id via errnos.

see #20709 (comment) for
rationale.

close GH-20731
@psumbera psumbera force-pushed the github-solaris-ci branch 2 times, most recently from 3971a8f to db47277 Compare January 7, 2026 10:11
@psumbera psumbera force-pushed the github-solaris-ci branch 2 times, most recently from e711432 to 58ee7f0 Compare February 9, 2026 15:51
@psumbera psumbera force-pushed the github-solaris-ci branch 2 times, most recently from 998f8ba to 97b36c0 Compare February 9, 2026 19:24
@psumbera psumbera requested a review from derickr February 10, 2026 08:12
@psumbera
Copy link
Contributor Author

I believe this should be now ready to go.

<?php
if (getenv("SKIP_BROKEN_PSET_CREATE")) {
die("skip broken pset_create()");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this excluded specially, rather than with usual the PHP_OS_FAMILY === 'Solaris' check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason was that this might work sometimes. Maybe for Illumos?

@psumbera psumbera force-pushed the github-solaris-ci branch 2 times, most recently from e9808d1 to 7ba6892 Compare February 11, 2026 17:31
@psumbera
Copy link
Contributor Author

psumbera commented Mar 2, 2026

I believe everything was resolved here. What shall be done now in order to merge this change?

@iluuu1994
Copy link
Member

@psumbera There were big changes in CI. I can resolve the conflicts for you. After that I'll do another review.

@iluuu1994 iluuu1994 force-pushed the github-solaris-ci branch from d4d0613 to 3b758f3 Compare March 2, 2026 22:23
@iluuu1994 iluuu1994 force-pushed the github-solaris-ci branch 2 times, most recently from 32fe148 to f12d59c Compare March 2, 2026 22:26
@iluuu1994 iluuu1994 force-pushed the github-solaris-ci branch from f12d59c to e23292d Compare March 2, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants