Reply to Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

Your name:

Reply:


Posted by Rasmus Lerdorf on 01/06/05 18:59

On Thu, 6 Jan 2005, Jason Barnett wrote:
> Symbulos Partners wrote:
> > We know that. We understood all of that.
> >
>
> Let me ask you this. Do you know what underlying libraries are associated
> with the extensions you want to use (in your list below)? If you do then you
> *should* be able to google for each library individually and see if that
> library is thread safe. I have not gone through this exercise for myself, but
> then again I don't need to either. ;) This would also be something that
> would be a great benefit to share with the PHP community if you decide to
> compile this list of thread-safe extensions.

Keep in mind that it isn't that simple. If it was we would have done this
long ago. Whether something is threadsafe depends on a lot of factors.
The author of a certain library might tell you his library is threadsafe,
but depending on how you compile it and which libc you are using it may or
may not be threadsafe. So, while one person's library on his platform
will work perfectly and be threadsafe, that exact same library on another
platform may not be.

Some examples of this are the c-client (imap) library and the postgresql
library. Both may or may not be threadsafe depending on your platform and
how you build them. Your crypt() libc call isn't threadsafe, for example.
libpq used to call crypt() if you used the PASSWD() function in an SQL
query. Now you might tick along for months without ever having 2 threads
execute the SQL query that calls PASSWD() at exactly the same time, but
then suddenly your lucky karma runs out and they do. You end up with 2
records in your database that are corrupted. The PostgreSQL guys fixed
this, I think, but prior to this they were saying that libpq was
threadsafe. The problem is always in code you don't control. They didn't
control the libc crypt implementation and it bit them.

I guarantee that there are dozens if not hundreds of examples of problems
like this in just about every library, and probably a few left in PHP
itself still. Unless someone hits a problem (which is likely) and
recognizes it for what it is (which is unlikely) and informs the
developers these tricky thread problems are never going to be fixed.

I still content that humans are simply not smart enough to write
threadsafe code for a largescale heterogenious project such as PHP with
all the platforms and libraries that all have to interact perfectly.

-Rasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация