Re: Bug #17522 [Com]: Connections to RabbitMQ (via CLI)
| From: | Pierrick Charron | Date: | Tue, 27 Sep 2011 15:09:35 +0000 |
| Subject: | Re: Bug #17522 [Com]: Connections to RabbitMQ (via CLI) | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-8576@lists.php.net to get a copy of this message | ||
Hi :)
The problem is that the null is not used the same way in all stomp
implementations. I quickly tried your patch on ActiveMQ (the one i'm
using) and few tests are now failing.
Do you have an instance of RabbitMQ installed somewhere I can access
it so that I can try and work on a patch ?
P.
On 27 September 2011 10:43, marcelog at gmail dot com
<pecl-dev@lists.php.net> wrote:
> Edit report at
> http://pecl.php.net/bugs/bug.php?id=17522&edit=1
>
> ID: 17522
> Comment by: marcelog at gmail dot com
> Reported By: alex at zander dot net
> Status: Open
> Id: 17522
> Type: Bug
> Package: stomp
> Operating System: Linux (Centos 4.6)
> PHP Version: Stomp 1.0.0, PHP 5.2.11
> New Comment:
>
> This issue is still present in 1.0.3, tested with rabbitmq
> 2.6.1.
>
> I'm curious about why the newline is expected after the null
> character, and if there's any reason to not fix this
> behaviour.
>
> According to the STOMP protocol
> (http://docs.codehaus.org/display/STOMP/Protocol)
>
> "The ^@ is a null (control-@ in ASCII) byte. The entire thing
> will be called a Frame in this doc. The frame starts with a
> command (in this case CONNECT), followed by a newline,
> followed by headers in a <key>:<value> with each header
> followed by a newline. A blank line indicates the end of the
> headers and beginning of the body (the body is empty in this
> case), and the null indicates the end of the frame."
>
> Ending the reading loop as soon as the null character is
> encountered (yes, a very naive approach), seems to fix the
> problem, but I'm not sure about any side-effects on doing
> this. However, it seems to work ok
>
> if (buffer[i-1] == 0) {
> //char endline[1];
> //if (1 != stomp_recv(stomp, endline, 1) && '\n'
> != endline[0]) {
> // efree(buffer);
> // return 0;
> //}
> break;
> }
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2010-12-16 21:29:57] x at x dot com
>
> After a bit of debug (I'm having the same issue with rabbit), it turns
> out rabbit's stomp adapter doesn't send out a newline after the message
> end NULL. So, stomp_read_buffer freezes on stomp_recv(stomp, endline, 1)
> waiting for the newline.
>
> Rather than throwing away the newline after the null (which might not
> even be there on rabbitmq), I'd suggest just leaving it to be processed
> with the top of the next message. While parsing the next frame, just
> throw away the first line if it's empty.
>
> Or, at the very minimum, give us a parameter to disable waiting for
> newlines after the nulls ;)
>
> ------------------------------------------------------------------------
>
> [2010-08-15 20:12:20] kalle at php dot net
>
> Hi, have you tried the latest version of stomp? And are you using Stomp
> over SSL?
>
> ------------------------------------------------------------------------
>
> [2010-05-15 21:30:20] alex at zander dot net
>
> Updated version information.
>
> ------------------------------------------------------------------------
>
> [2010-05-15 21:27:36] alex at zander dot net
>
> Description:
> ------------
> I am attempting to connect to a RabbitMQ service that has
> been tested and is known to support connections via STOMP
> using other methods.
>
> I have installed this PECL and it appears to be installed
> correctly because it is included in the output from
> phpinfo() and the RabbitMQ log file shows my PHP application
> connecting successfully.
>
> My PHP application is run from the command-line (i.e. not
> via a web server) and it executes successfully but when it
> reaches the line that instantiates the Stomp class it
> freezes and does not progress or terminate until I kill it
> using CTRL-C.
>
>
>
> Reproduce code:
> ---------------
> #!/usr/bin/php
> <?
> try {
> $URI = 'tcp://localhost:61613';
> $conn = new Stomp ( 'tcp://localhost:61613', 'guest',
> 'guest' );
> } catch( StompException $e ) {
> die( $e->getMessage()."\n" );
> }
> echo "This line never gets executed!";
> ?>
>
> Expected result:
> ----------------
> When running the application from the command-line, it should
> execute and output the string "This line never gets
> executed!".
>
> Actual result:
> --------------
> If the username or password are incorrect or not included then
> the application outputs "Unexpected EOF while reading from
> socket" and terminates.
>
> If the username and password are correct then the application
> does not do anything - it does not return from the Stomp
> class's constructor and nothing is output. The application
> does not terminate until I manually terminate it using CTRL-C.
>
> ------------------------------------------------------------------------
>
>
> --
> Edit this bug report at
>http://pecl.php.net/bugs/bug.php?id=17522&edit=1
>
>