Closed SwenVanZanten closed 3 years ago
@SwenVanZanten I think that was already fixed in master
, see https://github.com/php/pecl-networking-gearman/commit/89db5655df81b1a2123733e65c03d74ea23064f7.
It did fix running in PHP 7.4, however it doesn't work for the test scenario's I've added in the PR. If you run those on master they'll fail.
@Trainmaster hi any chance to check this PR out?
@SwenVanZanten
I can confirm the problem.
I think better solution is to remove zend_object_std_dtor
call in destructors.
Because it is called in free_obj by default.
I tried your fixes, and it completes all the tests, but I'm still getting segmentation faults using PHP 7.4.3.
I tried your fixes, and it completes all the tests, but I'm still getting segmentation faults using PHP 7.4.3.
With serialization & unserialization or another use case?
Maybe @nikic can help us out at this point (https://github.com/php/php-src/commit/1cfbb21790ff6dd4931223c5bdc18a0cebf3ffd4). Because I would say that
It is recommended to initialize object handler structures by copying the std object handlers and only overwriting those you want to change.
was implemented by https://github.com/php/pecl-networking-gearman/commit/afd2ed880c67455fbf28097dfde7bd3e368c183e.
@Trainmaster Presumably there was a reason why the object destruction was previously skipped -- most likely, it was to work around a refcounting bug somewhere else.
From a quick look, I'd assume that this kind of code is the root problem: https://github.com/php/pecl-networking-gearman/blob/a787fa0ca5ff5ab4abc30d440ddfc77eea55b825/php_gearman_task.c#L130-L143 That code should be inside the free_obj handler, not in destruct(). Putting it in destruct() is trivially unsound if you consider that the method may be manually invoked multiple times.
I tried your fixes, and it completes all the tests, but I'm still getting segmentation faults using PHP 7.4.3.
With serialization & unserialization or another use case?
Actually, just using $client = new GearmanClient();
will cause one.
@Trainmaster Presumably there was a reason why the object destruction was previously skipped -- most likely, it was to work around a refcounting bug somewhere else.
From a quick look, I'd assume that this kind of code is the root problem:
That code should be inside the free_obj handler, not in destruct(). Putting it in destruct() is trivially unsound if you consider that the method may be manually invoked multiple times.
Thnx @nikic !
I'll give it another go tomorrow
Added extra test cases for GearmanTask and GearmanWorker
If it's stable please push tag with new version
@rlerdorf removed the Note: This is no longer under active development.
. Maybe he can tell us who's in charge of this repository now.
I can confirm, this PR fixes segfaults seen with PHP 7.4. 👍🏿
Hi folks, when can we see all these pull requests finally merged??
I also confirm it's stable
I've encountered a problem with upgrading a codebase to PHP 7.4 using the latest build of this extension.
In this situation we have some objects which contain a GearmanJob object. When serializing and unserializing a bunch of them you'll get a Segmentation Fault.
I'm not familiar with writing code in C and I'm not sure this is the proper solution to the problem. So correct me if I'm wrong here! However it solves my problem and doesn't introduce any new once... according to the testsuite 😜