protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.5k stars 15.46k forks source link

Make PHP Extension thread-safe #6506

Open prolic opened 5 years ago

prolic commented 5 years ago

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

TeBoring commented 5 years ago

What’s your multithread environment?

On Tue, Aug 13, 2019 at 11:31 Sascha-Oliver Prolic notifications@github.com 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 .

prolic commented 5 years ago

ext-parallel or ext-pthreads in Linux

On Tue, Aug 13, 2019, 14:37 Paul Yang notifications@github.com wrote:

What’s your multithread environment?

On Tue, Aug 13, 2019 at 11:31 Sascha-Oliver Prolic < notifications@github.com> 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 .

m6w6 commented 5 years ago

What’s your multithread environment?

embed SAPI w/ ZTS (pthreads on Linux)

haberman commented 2 years ago

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

m6w6 commented 2 years ago

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

ClosetGeek-Git commented 2 years ago

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.