[rabbitmq-discuss] Librabbitmq

Pieter de Zwart pdezwart at rubiconproject.com
Thu May 27 16:37:31 BST 2010


Hey David,

Thanks for the tips. As you could probably tell, I have little knowledge in
this area. I will go with option #3 in this case and let you guys know how
it work out.

Pieter



On 5/27/10 7:47 AM, "David Wragg" <david at rabbitmq.com> wrote:

> Hi Pieter,
> 
> Pieter de Zwart <pdezwart at rubiconproject.com> writes:
>> > I am having some trouble with the librabbitmq library, and I am hoping you
>> > can help me out. We have managed to created a situation whereby a
>> connection
>> > gets closed down, but the PHP client does not know about it yet. As a
>> > result, when it tries to clean itself up with amqp_channel_close(), a
>> > SIGPIPE is thrown and PHP gets all kinds of pissed off.
>> >
>> > I was wondering if you could help me either:
>> >
>> > 1. catch SIGPIPE in the PHP C client somehow. (I am a n00b.)
>> >
>> > 2. pass some sort of flag to the connection to ignore SIGPIPE and return
>> > false instead. In case you are as clueless as I am (I am sure you are not,
>> > but just in case) I found this:
>> > setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
> 
> I haven't heard of SO_NOSIGPIPE before - it seems to be only available
> on OS X.
> 
> There are a couple of other options:
> 
> 3. If the process sets the handler for SIGPIPE to SIG_IGN, then SIGPIPE
>   will not be raised, and the offending write call will fail with EPIPE.
>   A lot of UNIX processes do this, I believe; SIGPIPE is often more of a
>   nuisance than a feature.  librabbitmq will propagate EPIPE, I expect.
> 
> 4. If, instead of using write(2), we use send(2) and specify the
>   MSG_NOSIGNAL flag, then SIGPIPE will not be raised, and the send call
>   will fail with EPIPE.  It sounds like modifying amqp_channel_close to
>   do this might make sense: There's little value in a SIGPIPE
>   when we are trying to close the connection anyway. Unfortunately,
>   MSG_NOSIGNAL is only supported by some OSes.
> 
> I suspect that (3) might be your best option, at least for now.  It's
> process wide, but if PHP isn't happy about getting SIGPIPE, that is
> probably quite reasonable.
> 
> David
> 
> --
> David Wragg
> Staff Engineer, RabbitMQ
> SpringSource, a division of VMware
> 

-- 
the rubicon project

PIETER DE ZWART | INTERFACES ENGINEER

€€€ P 310 207 0272 | x224
€€€ F 323 466 7119


1925 S. BUNDY  DRIVE
LOS ANGELES, CALIFORNIA 90025

WWW.RUBICONPROJECT.COM <http://www.rubiconproject.com/>


³COMPANY OF THE YEAR² ALWAYSON ONMEDIA 2009
#24 ON FAST COMPANY FAST 50 READER FAVORITES
2008  ALWAYSON 250 GLOBAL WINNER
2008 ALWAYSON ONMEDIA 100 WINNER
TWIISTUP3  BEST IN SHOW
PRICEWATERHOUSECOOPERS ­ ENTRETECH  BEST STARTUP
AMERICAN BUSINESS AWARDS - STEVIES  Œ08 FINALIST BEST NEW COMPANY
AMERICAN BUSINESS  AWARDS - STEVIES Œ08 FINALIST MOST INNOVATIVE COMPANY
AMERICAN BUSINESS  AWARDS - STEVIES Œ08 FINALIST NEW PRODUCT OR SERVICE -
SERVICES

P          Please consider the environment before printing this e-mail

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100527/e310dc35/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 28320 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100527/e310dc35/attachment-0001.png 


More information about the rabbitmq-discuss mailing list