Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reading data. Received 0 instead of expected 7 bytes #272

Closed
arogachev opened this issue May 18, 2015 · 11 comments
Closed

Error reading data. Received 0 instead of expected 7 bytes #272

arogachev opened this issue May 18, 2015 · 11 comments

Comments

@arogachev
Copy link

I'm using Vagrant + puphpet, together with this extension. Recently I updated to the latest versions and now struggling with this issue.

There are some problems with applying configuration (at least for me).
User guest was existing by default, but when I tried:

sudo rabbitmqctl list_user_permissions guest

it says:

Listing permissions for user "guest" ...
Error: {no_such_user,<<"guest">>}

So I executed these commands manually for testing purposes.

sudo rabbitmqctl add_vhost /
sudo rabbitmqctl add_user guest guest // was already existing as default
sudo rabbitmqctl set_permissions -p / guest ".*" ".*" ".*"

Now if I execute:

sudo rabbitmqctl list_user_permissions guest

It gives the following results:

Listing permissions for user "guest" ...
/      .*      .*      .*
...done.

Then I restarted rabbit server like that:

sudo service rabbitmq-server restart

Connection is created like that:

$connection = new AMQPConnection('127.0.0.1', 5672, 'guest', 'guest', '/');

According to trace, error appears right on this line. Here is full error text:

PhpAmqpLib\Exception\AMQPRuntimeException

Error reading data. Received 0 instead of expected 7 bytes

puphpet config rabbitmq section:

rabbitmq:
    install: '1'
    settings:
        port: '5672'
    users:
        user-1:
            admin: true
            name: admin
            password: admin
            permissions:
                permissions-1:
                    host: /
                    configure_permission: '.*'
                    read_permission: '.*'
                    write_permission: '.*'
    vhosts:
        - /
    plugins: {  }

I also tried with admin user, the result is the same error.

@thiagotalma
Copy link
Contributor

You read this?

@arogachev
Copy link
Author

Yes, but seems like credentials are right.

@arogachev
Copy link
Author

Solved. This was because of old version of RabbitMQ. Updated to the last stable version - and this error disappeared.

@lerox
Copy link

lerox commented Sep 16, 2015

We had the same exception when consuming... (Debian)

Fixed with:

-use PhpAmqpLib\Connection\AMQPSocketConnection;
+use PhpAmqpLib\Connection\AMQPStreamConnection;

😛

@genepeng
Copy link

genepeng commented Sep 28, 2016

I got the same exception, after I comment out the use_socket in config file, it works well

#requires php_sockets.dll
#use_socket: true # default false

@sfrlinton
Copy link

I had this issue, resolved by adding the following to my Dockerfile:

RUN docker-php-ext-install sockets mbstring

@unixslayer
Copy link

installing mbstring fixed issue for me

@mente
Copy link
Contributor

mente commented Nov 7, 2016

Have thhe same problem after switching from StreamConnection to SocketConnection, which is weird. We do have mbstring installed.

Issue is reproducible both on php5.6 and php7

@mente
Copy link
Contributor

mente commented Nov 7, 2016

From my findings:

AMQPSocketConnection does not support heartbeat, thus it timeouts.
Also constructor signature for AMQPSocketConnection is different from AMQPStreamConnection and rabbitmq-bundle ignores these differences

@trainking
Copy link

I also encountered the same problem. My version is 3.7.5.mbstring, sockets is installed.

Set heartbeat is 1 fixed issue is for me.

@masterfaka
Copy link

We had the same exception when consuming... (Debian)

Fixed with:

-use PhpAmqpLib\Connection\AMQPSocketConnection;
+use PhpAmqpLib\Connection\AMQPStreamConnection;

I'm on ubuntu facing the same issue with RabbitMQ version: 3.8.2
and symfony 4.3.4
but the use you mention is just on the vendor/...files . even so I did the change and nothing happened.. would you care specifying in more detail please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants