- edited description
Bug of stream conversion
I use Amp framework with event extension and sometimes get error: 2 bytes of buffered data lost during stream conversion. See https://github.com/amphp/amp/issues/276. Use docker based on php:7.3-cli-alpine
Comments (12)
-
reporter -
repo owner Could you provide a script to reproduce this issue?
I understand that the issue occurs randomly, but I have to have something to work on.
-
reporter Unfortunately, there is no possibility to provide the script, because for this is need to provide partial access to a commercial application =)
At the weekend I think can to find time for a small demo application with the same stack and similar behavior. -
repo owner Well, the error comes from PHP internals
if ((stream->writepos - stream->readpos) > 0 && stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE && (flags & PHP_STREAM_CAST_INTERNAL) == 0 ) { /* the data we have buffered will be lost to the third party library that * will be accessing the stream. Emit a warning so that the end-user will * know that they should try something else */ php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); }
I don't know how to handle this case, since the
_php_stream_cast
function returnsSUCCESS
despite of the error condition.The code is called when Event constructor tries to obtain numeric file descriptor from a PHP stream resource. The warning should disappear, if you pass a numeric file descriptor, or a socket resource instead of a stream
-
repo owner - changed status to resolved
Fixed
#56: a warning occurred randomly when PHP stream cast via php_stream_cast() without the PHP_STREAM_CAST_INTERNAL flag→ <<cset 04a2dc597767>>
-
repo owner @deadbeat Could you test if the warning occurs with the latest changes?
-
reporter I have problem with installing for php 7.3.3 at alpine (docker), locally for php-7.2.18 at debian 8 is OK. Installing with pecl is OK for 7.3
Step 6/12 : RUN set -xe && cd /var/www/pecl-event/ && phpize && ./configure --with-event-core --with-event-extra --enable-event-debug && make && make install && echo "extension=event.so" > /usr/local/etc/php/conf.d/event.ini && pecl install raphf && docker-php-ext-enable raphf && pecl install pq && echo "extension=pq.so" > /usr/local/etc/php/conf.d/pq.ini && pecl install dbase-7.0.0beta1 && echo "extension=dbase.so" > /usr/local/etc/php/conf.d/dbase.ini && rm -rf /tmp/* /var/cache/apk/*
---> Running in 0ae6ff0b7d7d
+ cd /var/www/pecl-event/
+ phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
+ ./configure --with-event-core --with-event-extra --enable-event-debug
...
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
...
checking whether Event debugging support enabled... yes
checking whether to enable sockets support in Event... yes
checking PHP version... configure: error: unknown source
ERROR: Service 'backend' failed to build: The command '/bin/sh -c set -xe && cd /var/www/pecl-event/ && phpize && ./configure --with-event-core --with-event-extra --enable-event-debug && make && make install && echo "extension=event.so" > /usr/local/etc/php/conf.d/event.ini && pecl install raphf && docker-php-ext-enable raphf && pecl install pq && echo "extension=pq.so" > /usr/local/etc/php/conf.d/pq.ini && pecl install dbase-7.0.0beta1 && echo "extension=dbase.so" > /usr/local/etc/php/conf.d/dbase.ini && rm -rf /tmp/* /var/cache/apk/*' returned a non-zero code: 1
-
repo owner Looks like
/var/www/pecl-event/
doesn't containphp7
directory. -
reporter Sorry, it was my mistake at the previous steps with
COPY ./pecl-event/*
instead ofCOPY ./pecl-event
, the first option don't keep the directory structure. After installing I get the following errorPHP Warning: PHP Startup: Unable to load dynamic library 'event.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/event.so (Error loading shared library libevent_openssl-2.0.so.5: No such file or directory
I don’t know why it is happened(( I have installed librarieslibevent-dev, libressl-dev
,openssl-dev
and decided to check with commandpkg-config --libs libevent_openssl
and it turned out that I have a more recent version -/usr/lib/libevent_openssl-2.1.so.6
-
reporter For version 7.3 is failed to install, I tried stretch and alpine, for version 7.2 is OK and no error of stream conversion.
-
repo owner @deadbeat Well, then I’ll rather publish a new PECL release. I think the changes are safe enough.
-
repo owner @deadbeat Fixed in event-2.5.3
- Log in to comment