protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Make PHP Extension thread-safe

Open prolic opened this issue 4 years ago • 6 comments

What language does this apply to? PHP

Describe the problem you are trying to solve. I need the PHP extension to be thread-safe in order to use it in a multithreading environment in PHP.

Additional context see also https://github.com/krakjoe/parallel/issues/78

prolic avatar Aug 13 '19 18:08 prolic

What’s your multithread environment?

On Tue, Aug 13, 2019 at 11:31 Sascha-Oliver Prolic [email protected] wrote:

What language does this apply to? PHP

Describe the problem you are trying to solve. I need the PHP extension to be thread-safe in order to use it in a multithreading environment in PHP.

Additional context see also krakjoe/parallel#78 https://github.com/krakjoe/parallel/issues/78

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf/issues/6506?email_source=notifications&email_token=ABHUPZP5O5RGJ3ZMBPOH4L3QEL4WVA5CNFSM4ILNRQCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFA274Q, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHUPZKLFQTMJBMCYGM44ETQEL4WVANCNFSM4ILNRQCA .

TeBoring avatar Aug 13 '19 18:08 TeBoring

ext-parallel or ext-pthreads in Linux

On Tue, Aug 13, 2019, 14:37 Paul Yang [email protected] wrote:

What’s your multithread environment?

On Tue, Aug 13, 2019 at 11:31 Sascha-Oliver Prolic < [email protected]> wrote:

What language does this apply to? PHP

Describe the problem you are trying to solve. I need the PHP extension to be thread-safe in order to use it in a multithreading environment in PHP.

Additional context see also krakjoe/parallel#78 https://github.com/krakjoe/parallel/issues/78

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/protocolbuffers/protobuf/issues/6506?email_source=notifications&email_token=ABHUPZP5O5RGJ3ZMBPOH4L3QEL4WVA5CNFSM4ILNRQCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFA274Q , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABHUPZKLFQTMJBMCYGM44ETQEL4WVANCNFSM4ILNRQCA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf/issues/6506?email_source=notifications&email_token=AADAJPFITMQKRTFET2KOZILQEL5QFA5CNFSM4ILNRQCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4GSP4I#issuecomment-520955889, or mute the thread https://github.com/notifications/unsubscribe-auth/AADAJPECPKRF4FD6JK4DURDQEL5QFANCNFSM4ILNRQCA .

prolic avatar Aug 13 '19 19:08 prolic

What’s your multithread environment?

embed SAPI w/ ZTS (pthreads on Linux)

m6w6 avatar Sep 04 '19 09:09 m6w6

Is anybody still using PHP with threads?

When I researched this a couple years ago, my conclusion was that PHP with threads is deprecated: https://github.com/protocolbuffers/protobuf/blob/92cdf87f1a276356657ca1b426c115bff0ad2798/php/ext/google/protobuf/protobuf.c#L142-L153

haberman avatar Mar 08 '22 17:03 haberman

Making an extension thread-safe and thus usable with a thread-safe build of PHP, doesn't have anything to do with whether there's exposure of threading primitives to userland, f.e. by an extension like pthreads or parallel, where btw the latter is the successor to the former. https://www.php.net/manual/en/parallel.setup.php

Also, the fact that PHP's configure command renamed the --enable-maintainer-zts flag to just --enable-zts, doesn't count as an evidence for your conclusion either: https://www.php.net/manual/en/configure.about.php#configure.enable-zts

m6w6 avatar Mar 08 '22 17:03 m6w6

This is where too many people get confused about thread-safe PHP development. It's not just about the userspace environment but the PHP virtual machine as well. PHP extensions need to be thread safe so that the virtual machine can be used in threaded server environments.

ClosetGeek-Git avatar Aug 02 '22 05:08 ClosetGeek-Git