[asterisk-bugs] [Asterisk 0014379]: AMI shows utils.c:1198 ast_careful_fwrite: fflush() returned error: Broken pipe

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Feb 5 07:54:39 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14379 
====================================================================== 
Reported By:                chris-mac
Assigned To:                putnopvut
====================================================================== 
Project:                    Asterisk
Issue ID:                   14379
Category:                   Core/ManagerInterface
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.1 
SVN Revision (number only!): 172030 
Request Review:              
====================================================================== 
Date Submitted:             2009-01-31 16:50 CST
Last Modified:              2009-02-05 07:54 CST
====================================================================== 
Summary:                    AMI shows utils.c:1198 ast_careful_fwrite: fflush()
returned error: Broken pipe
Description: 
When sending data to AMI socket, without reading (waiting for) response -
console shows:

ERROR[5148]: utils.c:1198 ast_careful_fwrite: fflush() returned error:
Broken pipe

How to reproduce:
0. You will need php5-cli installed
1. Download 'AMI.class.php' and 'ami-test.php' attached.
2. Edit AMI username/password in 'ami-test.php'.
3. Run ./ami-test.php
4. Watch Asterisk console

NOTE: To revert back to a 'normal' behaviour, change line 72 of
'AMI.class.php' to: 'public $sync = true;'


====================================================================== 

---------------------------------------------------------------------- 
 (0099490) khratos (reporter) - 2009-02-05 07:54
 http://bugs.digium.com/view.php?id=14379#c99490 
---------------------------------------------------------------------- 
I tested the patch.

I'm using the UdateConfig command not only for modifying the existent
config files, but also in order to create new ones that are to be included
on existent config files.

a. Reading files from a directory
b. making changes
c. saving them on destination directories.

After the first 'broken pipe' message I confirm that some files are
written, but the same behavior was confirmed on an unpatched installation
(another box) with Asterisk 1.4.23.1

I also confirmed that the problem get worst when PHP is acting as a client
for a remote Asterisk Server (even on the same LAN).

IMO, as this is obviously a PHP buggy way of managing sockets (as you can
not turn off response buffering), maybe the solution is to find a
workaround on client side. Unfortunately, when sockets are general purpose
socket ( socket_create ), not 'stream socket' ( fsockopen ), the problem is
even worst; because you can not (even if they say so) control the stream
timeout (stream_set_timeout) on them. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-02-05 07:54 khratos        Note Added: 0099490                          
======================================================================




More information about the asterisk-bugs mailing list