parallel icon indicating copy to clipboard operation
parallel copied to clipboard

Error in test and warnings in compilation: unused function 'php_parallel_sync_fetch' + 'php_parallel_sync_from' (php 8.4-zts)

Open vovkapoc opened this issue 11 months ago • 2 comments

In compilation process latest parallel (master branch) I see this warnings:

/private/tmp/parallel/src/sync.c:33:48: warning: unused function 'php_parallel_sync_fetch' [-Wunused-function]
static zend_always_inline php_parallel_sync_t* php_parallel_sync_fetch(zend_object *o) {
                                               ^
/private/tmp/parallel/src/sync.c:40:48: warning: unused function 'php_parallel_sync_from' [-Wunused-function]
static zend_always_inline php_parallel_sync_t* php_parallel_sync_from(zval *z) {
                                               ^
2 warnings generated.

After running tests I see this errors:

FAIL Check sync get/set [tests/sync/002.phpt] 
FAIL Check sync notify one [tests/sync/003.phpt]

Compiled used homebrew tools in MacOS [arm64] PHP version:

PHP 8.4.0-dev (cli) (built: Mar  6 2024 19:11:50) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.0-dev, Copyright (c), by Zend Technologies

How to fix this?

vovkapoc avatar Mar 08 '24 07:03 vovkapoc

Hey @vovkapoc,

I took a quick look at the failing tests. In both cases it looks to me that the actual functionality in the \parallel\Sync object works as intended, it is just that for some reason var_dump() is not aware of the value property of that object in the calling thread. Calling $sync->get() returns 42, which is also why the tests does not get stuck in an infinit wait 😉

You can recognize this by changing the argument in the $sync->set(42) call from 42 to another number. The test will then run forever (or until the max_execution_time is reached, whichever comes first).

Hope this helps at least a little.

Kind regards Florian

realFlowControl avatar Mar 22 '24 08:03 realFlowControl

Hey @vovkapoc,

I took a quick look at the failing tests. In both cases it looks to me that the actual functionality in the \parallel\Sync object works as intended, it is just that for some reason var_dump() is not aware of the value property of that object in the calling thread. Calling $sync->get() returns 42, which is also why the tests does not get stuck in an infinit wait 😉

You can recognize this by changing the argument in the $sync->set(42) call from 42 to another number. The test will then run forever (or until the max_execution_time is reached, whichever comes first).

Hope this helps at least a little.

Kind regards Florian

Thanks for the answer, otherwise I already thought that in parallel there would be problems with synchronization due to an error in passing the tests... Maybe you will fix the tests so that they pass without problems and do not scare people?))

vovkapoc avatar Mar 24 '24 16:03 vovkapoc

Hey @vovkapoc, I just merged #289 into develop and the two failing tests in PHP 8.3 should be gone.

realFlowControl avatar May 12 '24 18:05 realFlowControl