You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Christopher Shannon <ch...@gmail.com> on 2015/07/01 04:39:41 UTC

Re: ActiveMQ(MQTT) crash when subscribe

Is the full stack trace in a log file that you could paste?  It would make
it easier to track down where the out of bounds exception happened.

Also, can you try running against the latest 5.12.0-SNAPSHOT? There's been
some work done to MQTT over Websockets and I'm wondering if this issue
still exists against the latest build.

On Mon, Jun 29, 2015 at 4:08 PM, roox_4000 <re...@gmail.com> wrote:

> I Download ActiveMQ Broker v5.11.1 And Run It (Use MQTT). I Can Publish And
> Subscribe With Websocket & PHP For Publish And Broker Work Well.
>
> But When Use PHP for subscribe Broker Console Give Me This ERROR And Dont
> Subscribe Topic
>
> WARN : Transport Connection to :tcp://127.0.0.1:18967
>      failed:java.io.IOExeption:Unexpected error
>      occurred:java.lang.ArrayIndexOutOfBoundsException :12
>
> <http://activemq.2283324.n4.nabble.com/file/n4698367/activemq.jpg>
>
> This Error In A loop That Port Error(tcp://127.0.0.1:18967) In Each Period
> Is Changed
>
> Subscribe.php :
>
> <?php
>
> require("../phpMQTT.php");
>
>
> $mqtt = new phpMQTT("localhost", 1883, "phpMQTT Sub Example"); //Change
> client name to something unique
>
> if(!$mqtt->connect()){
>     exit(1);
> }
>
> $topics['chat/general'] = array("qos"=>0, "function"=>"procmsg");
> $mqtt->subscribe($topics,0);
>
> while($mqtt->proc()){
>
> }
>
>
> $mqtt->close();
>
> function procmsg($topic,$msg){
>         echo "Msg Recieved: ".date("r")."\nTopic:{$topic}\n$msg\n";
> }
>
>
>
> ?>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: ActiveMQ(MQTT) crash when subscribe

Posted by roox_4000 <re...@gmail.com>.
I use https://github.com/sskaje/mqtt Lib And It  Work With Activemq Broker
Very Well 



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4699314.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ(MQTT) crash when subscribe

Posted by Christopher Shannon <ch...@gmail.com>.
So good news, it turns out if you enable debug logging there is already a
check in place to log the full stack trace. Take a look at this page:
http://activemq.apache.org/how-do-i-enable-debug-logging.html for
instructions on how to enable debug and then you should get the full print
out of the ArrayIndexOutOfBoundsException that you are getting.

On Tue, Jul 14, 2015 at 9:42 AM, Christopher Shannon <
christopher.l.shannon@gmail.com> wrote:

> It's difficult to track down the cause based on what you have provided
> because unfortunately the full stack trace is missing for the
> ArrayIndexOutOfBoundsException.  The broker needs to be updated to log the
> full stack trace which I can update.  I can let you know when the latest
> snapshot has that change so you can try it again and hopefully have some
> more information to help debug the issue.
>
> Also, I doubt many people here are familiar with using that PHP client.
> Would it be possible to try your example with a different kind of client to
> see if the issue still exists? The easiest to debug is if it is a Java test
> case.
>
> On Tue, Jul 14, 2015 at 7:08 AM, roox_4000 <re...@gmail.com>
> wrote:
>
>> My project is very important and because of this problem it has been
>> down. I
>> asked many times from supporters, the answered once but it didn't help
>> me. I
>> really need to know how to solve the problem.
>> I appreciate it if anybody can help.
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4699230.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>

Re: ActiveMQ(MQTT) crash when subscribe

Posted by Christopher Shannon <ch...@gmail.com>.
It's difficult to track down the cause based on what you have provided
because unfortunately the full stack trace is missing for the
ArrayIndexOutOfBoundsException.  The broker needs to be updated to log the
full stack trace which I can update.  I can let you know when the latest
snapshot has that change so you can try it again and hopefully have some
more information to help debug the issue.

Also, I doubt many people here are familiar with using that PHP client.
Would it be possible to try your example with a different kind of client to
see if the issue still exists? The easiest to debug is if it is a Java test
case.

On Tue, Jul 14, 2015 at 7:08 AM, roox_4000 <re...@gmail.com> wrote:

> My project is very important and because of this problem it has been down.
> I
> asked many times from supporters, the answered once but it didn't help me.
> I
> really need to know how to solve the problem.
> I appreciate it if anybody can help.
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4699230.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: ActiveMQ(MQTT) crash when subscribe

Posted by roox_4000 <re...@gmail.com>.
My project is very important and because of this problem it has been down. I
asked many times from supporters, the answered once but it didn't help me. I
really need to know how to solve the problem.
I appreciate it if anybody can help.






--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4699230.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ(MQTT) crash when subscribe

Posted by roox_4000 <re...@gmail.com>.
I Try With v5.12 Snapshot But activemq console give me laste error :

WARN : Transport Connection to :tcp://127.0.0.1:18967 
     failed:java.io.IOExeption:Unexpected error 
     occurred:java.lang.ArrayIndexOutOfBoundsException :12 

That 12 in Above Error Equal With Topic Character That I Enter In Subscribe
Method

chat/general =12 Character

$topics['*chat/general*'] = array("qos"=>0, "function"=>"procmsg"); 
$mqtt->subscribe($topics,0); 


This Subscribe Part Of phpMQTT Class (bluerhinos)  Tht I Use It 

  /* subscribe: subscribes to topics */ 
        function subscribe($topics, $qos = 0){ 
                $i = 0; 
                $buffer = ""; 
                $id = $this->msgid; 
                $buffer .= chr($id >> 8);  $i++; 
                $buffer .= chr($id % 256);  $i++; 

                foreach($topics as $key => $topic){ 
                        $buffer .= $this->strwritestring($key,$i); 
                        $buffer .= chr($topic["qos"]);  $i++; 
                        $this->topics[$key] = $topic; 
                } 

                $cmd = 0x80; 
                //$qos 
                $cmd +=	($qos << 1); 


                $head = chr($cmd); 
                $head .= chr($i); 
                
                fwrite($this->socket, $head, 2); 
                fwrite($this->socket, $buffer, $i); 
                $string = $this->read(2); 
                
                $bytes = ord(substr($string,1,1)); 
                $string = $this->read($bytes); 
        } 







--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4698578.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ(MQTT) crash when subscribe

Posted by roox_4000 <re...@gmail.com>.
my active mq log file after run & subscribe: 

2015-07-01 14:51:17,162 | INFO  | Refreshing
org.apache.activemq.xbean.XBeanBrokerFactory$1@56553e: startup date [Wed Jul
01 14:51:17 IRDT 2015]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2015-07-01 14:51:17,992 | INFO  |
PListStore:[E:\Mazarlou\apache-activemq-5.11.1\bin\..\data\localhost\tmp_storage]
started | org.apache.activemq.store.kahadb.plist.PListStoreImpl | main
2015-07-01 14:51:18,017 | INFO  | Using Persistence Adapter:
KahaDBPersistenceAdapter[E:\Mazarlou\apache-activemq-5.11.1\bin\..\data\kahadb]
| org.apache.activemq.broker.BrokerService | main
2015-07-01 14:51:18,496 | INFO  | KahaDB is version 5 |
org.apache.activemq.store.kahadb.MessageDatabase | main
2015-07-01 14:51:18,521 | INFO  | Recovering from the journal ... |
org.apache.activemq.store.kahadb.MessageDatabase | main
2015-07-01 14:51:18,527 | INFO  | Recovery replayed 15 operations from the
journal in 0.016 seconds. | org.apache.activemq.store.kahadb.MessageDatabase
| main
2015-07-01 14:51:18,676 | INFO  | Apache ActiveMQ 5.11.1 (localhost,
ID:wsdev26-27448-1435746078549-0:1) is starting |
org.apache.activemq.broker.BrokerService | main
2015-07-01 14:51:18,736 | INFO  | Listening for connections at:
tcp://wsdev26:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
| org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-01 14:51:18,739 | INFO  | Connector openwire started |
org.apache.activemq.broker.TransportConnector | main
2015-07-01 14:51:18,744 | INFO  | Listening for connections at:
amqp://wsdev26:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600
| org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-01 14:51:18,746 | INFO  | Connector amqp started |
org.apache.activemq.broker.TransportConnector | main
2015-07-01 14:51:18,751 | INFO  | Listening for connections at:
stomp://wsdev26:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
| org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-01 14:51:18,753 | INFO  | Connector stomp started |
org.apache.activemq.broker.TransportConnector | main
2015-07-01 14:51:18,760 | INFO  | Listening for connections at:
mqtt://wsdev26:1885?maximumConnections=1000&wireFormat.maxFrameSize=104857600
| org.apache.activemq.transport.TransportServerThreadSupport | main
2015-07-01 14:51:18,762 | INFO  | Connector mqtt started |
org.apache.activemq.broker.TransportConnector | main
2015-07-01 14:51:18,854 | INFO  | Listening for connections at
ws://wsdev26:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
| org.apache.activemq.transport.ws.WSTransportServer | main
2015-07-01 14:51:18,855 | INFO  | Connector ws started |
org.apache.activemq.broker.TransportConnector | main
2015-07-01 14:51:18,858 | INFO  | Apache ActiveMQ 5.11.1 (localhost,
ID:wsdev26-27448-1435746078549-0:1) started |
org.apache.activemq.broker.BrokerService | main
2015-07-01 14:51:18,859 | INFO  | For help or more information please see:
http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2015-07-01 14:51:19,163 | INFO  | ActiveMQ WebConsole available at
http://0.0.0.0:8161/ | org.apache.activemq.web.WebConsoleStarter | main
2015-07-01 14:51:19,228 | INFO  | Initializing Spring FrameworkServlet
'dispatcher' | /admin | main
2015-07-01 14:51:19,719 | INFO  | jolokia-agent: No access restrictor found
at classpath:/jolokia-access.xml, access to all MBeans is allowed | /api |
main
2015-07-01 14:51:25,895 | WARN  | Transport Connection to:
tcp://127.0.0.1:27453 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27453@1885
2015-07-01 14:51:25,906 | WARN  | Transport Connection to:
tcp://127.0.0.1:27454 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27454@1885
2015-07-01 14:51:26,022 | WARN  | Transport Connection to:
tcp://127.0.0.1:27455 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27455@1885
2015-07-01 14:51:26,154 | WARN  | Transport Connection to:
tcp://127.0.0.1:27456 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27456@1885
2015-07-01 14:51:26,279 | WARN  | Transport Connection to:
tcp://127.0.0.1:27457 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27457@1885
2015-07-01 14:51:26,404 | WARN  | Transport Connection to:
tcp://127.0.0.1:27458 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27458@1885
2015-07-01 14:51:26,529 | WARN  | Transport Connection to:
tcp://127.0.0.1:27459 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27459@1885
2015-07-01 14:51:26,635 | WARN  | Transport Connection to:
tcp://127.0.0.1:27460 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27460@1885
2015-07-01 14:51:26,744 | WARN  | Transport Connection to:
tcp://127.0.0.1:27461 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27461@1885
2015-07-01 14:51:26,862 | WARN  | Transport Connection to:
tcp://127.0.0.1:27462 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27462@1885
2015-07-01 14:51:26,980 | WARN  | Transport Connection to:
tcp://127.0.0.1:27463 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27463@1885
2015-07-01 14:51:27,096 | WARN  | Transport Connection to:
tcp://127.0.0.1:27464 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27464@1885
2015-07-01 14:51:27,222 | WARN  | Transport Connection to:
tcp://127.0.0.1:27465 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27465@1885
2015-07-01 14:51:27,347 | WARN  | Transport Connection to:
tcp://127.0.0.1:27466 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27466@1885
2015-07-01 14:51:27,456 | WARN  | Transport Connection to:
tcp://127.0.0.1:27467 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27467@1885
2015-07-01 14:51:27,581 | WARN  | Transport Connection to:
tcp://127.0.0.1:27468 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27468@1885
2015-07-01 14:51:27,706 | WARN  | Transport Connection to:
tcp://127.0.0.1:27469 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27469@1885
2015-07-01 14:51:27,815 | WARN  | Transport Connection to:
tcp://127.0.0.1:27470 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27470@1885
2015-07-01 14:51:27,921 | WARN  | Transport Connection to:
tcp://127.0.0.1:27471 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27471@1885
2015-07-01 14:51:28,030 | WARN  | Transport Connection to:
tcp://127.0.0.1:27472 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27472@1885
2015-07-01 14:51:28,147 | WARN  | Transport Connection to:
tcp://127.0.0.1:27473 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27473@1885
2015-07-01 14:51:28,278 | WARN  | Transport Connection to:
tcp://127.0.0.1:27474 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27474@1885
2015-07-01 14:51:28,403 | WARN  | Transport Connection to:
tcp://127.0.0.1:27475 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27475@1885
2015-07-01 14:51:28,528 | WARN  | Transport Connection to:
tcp://127.0.0.1:27476 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27476@1885
2015-07-01 14:51:28,659 | WARN  | Transport Connection to:
tcp://127.0.0.1:27477 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27477@1885
2015-07-01 14:51:28,776 | WARN  | Transport Connection to:
tcp://127.0.0.1:27478 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27478@1885
2015-07-01 14:51:28,892 | WARN  | Transport Connection to:
tcp://127.0.0.1:27479 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27479@1885
2015-07-01 14:51:29,017 | WARN  | Transport Connection to:
tcp://127.0.0.1:27480 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27480@1885
2015-07-01 14:51:29,142 | WARN  | Transport Connection to:
tcp://127.0.0.1:27481 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27481@1885
2015-07-01 14:51:29,252 | WARN  | Transport Connection to:
tcp://127.0.0.1:27482 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27482@1885
2015-07-01 14:51:29,377 | WARN  | Transport Connection to:
tcp://127.0.0.1:27483 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27483@1885
2015-07-01 14:51:29,486 | WARN  | Transport Connection to:
tcp://127.0.0.1:27484 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27484@1885
2015-07-01 14:51:29,611 | WARN  | Transport Connection to:
tcp://127.0.0.1:27485 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27485@1885
2015-07-01 14:51:29,736 | WARN  | Transport Connection to:
tcp://127.0.0.1:27486 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27486@1885
2015-07-01 14:51:29,845 | WARN  | Transport Connection to:
tcp://127.0.0.1:27487 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27487@1885
2015-07-01 14:51:29,960 | WARN  | Transport Connection to:
tcp://127.0.0.1:27488 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27488@1885
2015-07-01 14:51:30,076 | WARN  | Transport Connection to:
tcp://127.0.0.1:27489 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27489@1885
2015-07-01 14:51:30,193 | WARN  | Transport Connection to:
tcp://127.0.0.1:27490 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27490@1885
2015-07-01 14:51:30,307 | WARN  | Transport Connection to:
tcp://127.0.0.1:27491 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27491@1885
2015-07-01 14:51:30,432 | WARN  | Transport Connection to:
tcp://127.0.0.1:27492 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27492@1885
2015-07-01 14:51:30,557 | WARN  | Transport Connection to:
tcp://127.0.0.1:27493 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27493@1885
2015-07-01 14:51:30,667 | WARN  | Transport Connection to:
tcp://127.0.0.1:27494 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27494@1885
2015-07-01 14:51:30,792 | WARN  | Transport Connection to:
tcp://127.0.0.1:27495 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27495@1885
2015-07-01 14:51:30,919 | WARN  | Transport Connection to:
tcp://127.0.0.1:27496 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27496@1885
2015-07-01 14:51:31,038 | WARN  | Transport Connection to:
tcp://127.0.0.1:27497 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27497@1885
2015-07-01 14:51:31,155 | WARN  | Transport Connection to:
tcp://127.0.0.1:27498 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27498@1885
2015-07-01 14:51:31,288 | WARN  | Transport Connection to:
tcp://127.0.0.1:27499 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27499@1885
2015-07-01 14:51:31,397 | WARN  | Transport Connection to:
tcp://127.0.0.1:27500 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27500@1885
2015-07-01 14:51:31,507 | WARN  | Transport Connection to:
tcp://127.0.0.1:27501 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27501@1885
2015-07-01 14:51:31,616 | WARN  | Transport Connection to:
tcp://127.0.0.1:27502 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27502@1885
2015-07-01 14:51:31,726 | WARN  | Transport Connection to:
tcp://127.0.0.1:27503 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27503@1885
2015-07-01 14:51:31,851 | WARN  | Transport Connection to:
tcp://127.0.0.1:27504 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27504@1885
2015-07-01 14:51:31,964 | WARN  | Transport Connection to:
tcp://127.0.0.1:27505 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27505@1885
2015-07-01 14:51:32,080 | WARN  | Transport Connection to:
tcp://127.0.0.1:27506 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27506@1885
2015-07-01 14:51:32,197 | WARN  | Transport Connection to:
tcp://127.0.0.1:27507 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27507@1885
2015-07-01 14:51:32,312 | WARN  | Transport Connection to:
tcp://127.0.0.1:27508 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27508@1885
2015-07-01 14:51:32,437 | WARN  | Transport Connection to:
tcp://127.0.0.1:27509 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27509@1885
2015-07-01 14:51:32,562 | WARN  | Transport Connection to:
tcp://127.0.0.1:27510 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27510@1885
2015-07-01 14:51:32,687 | WARN  | Transport Connection to:
tcp://127.0.0.1:27511 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27511@1885
2015-07-01 14:51:32,812 | WARN  | Transport Connection to:
tcp://127.0.0.1:27512 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27512@1885
2015-07-01 14:51:32,937 | WARN  | Transport Connection to:
tcp://127.0.0.1:27513 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27513@1885
2015-07-01 14:51:33,047 | WARN  | Transport Connection to:
tcp://127.0.0.1:27514 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27514@1885
2015-07-01 14:51:33,172 | WARN  | Transport Connection to:
tcp://127.0.0.1:27515 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27515@1885
2015-07-01 14:51:33,297 | WARN  | Transport Connection to:
tcp://127.0.0.1:27516 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27516@1885
2015-07-01 14:51:33,422 | WARN  | Transport Connection to:
tcp://127.0.0.1:27517 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27517@1885
2015-07-01 14:51:33,547 | WARN  | Transport Connection to:
tcp://127.0.0.1:27518 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27518@1885
2015-07-01 14:51:33,672 | WARN  | Transport Connection to:
tcp://127.0.0.1:27519 failed: java.io.IOException: Unexpected error
occurred: java.lang.ArrayIndexOutOfBoundsException: 9 |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:27519@1885





--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4698436.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ(MQTT) crash when subscribe

Posted by roox_4000 <re...@gmail.com>.
my phpMQTT class :


<?php

/*
 	phpMQTT
	A simple php class to connect/publish/subscribe to an MQTT broker
 
*/

/*
	Licence

	Copyright (c) 2010 Blue Rhinos Consulting | Andrew Milsted
	andrew@bluerhinos.co.uk | http://www.bluerhinos.co.uk

	Permission is hereby granted, free of charge, to any person obtaining a
copy
	of this software and associated documentation files (the "Software"), to
deal
	in the Software without restriction, including without limitation the
rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
	
*/

/* phpMQTT */
class phpMQTT {

	private $socket; 			/* holds the socket	*/
	private $msgid = 1;			/* counter for message id */
	public $keepalive = 10;		/* default keepalive timmer */
	public $timesinceping;		/* host unix time, used to detect disconects */
	public $topics = array(); 	/* used to store currently subscribed topics */
	public $debug = false;		/* should output debug messages */
	public $address;			/* broker address */
	public $port;				/* broker port */
	public $clientid;			/* client id sent to brocker */
	public $will;				/* stores the will of the client */
	private $username;			/* stores username */
	private $password;			/* stores password */

	function __construct($address, $port, $clientid){
		$this->broker($address, $port, $clientid);
	}

	/* sets the broker details */
	function broker($address, $port, $clientid){
		$this->address = $address;
		$this->port = $port;
		$this->clientid = $clientid;		
	}

	function connect_auto($clean = true, $will = NULL, $username = NULL,
$password = NULL){
		while($this->connect($clean, $will, $username, $password)==false){
			sleep(10);
		}
		return true;
	}

	/* connects to the broker 
		inputs: $clean: should the client send a clean session flag */
	function connect($clean = true, $will = NULL, $username = NULL, $password =
NULL){
		
		if($will) $this->will = $will;
		if($username) $this->username = $username;
		if($password) $this->password = $password;

		$address = gethostbyname($this->address);	
		$this->socket = fsockopen($address, $this->port, $errno, $errstr, 60);

		if (!$this->socket ) {
		    if($this->debug) error_log("fsockopen() $errno, $errstr \n");
			return false;
		}

		stream_set_timeout($this->socket, 5);
		stream_set_blocking($this->socket, 0);

		$i = 0;
		$buffer = "";

		$buffer .= chr(0x00); $i++;
		$buffer .= chr(0x06); $i++;
		$buffer .= chr(0x4d); $i++;
		$buffer .= chr(0x51); $i++;
		$buffer .= chr(0x49); $i++;
		$buffer .= chr(0x73); $i++;
		$buffer .= chr(0x64); $i++;
		$buffer .= chr(0x70); $i++;
		$buffer .= chr(0x03); $i++;

		//No Will
		$var = 0;
		if($clean) $var+=2;

		//Add will info to header
		if($this->will != NULL){
			$var += 4; // Set will flag
			$var += ($this->will['qos'] << 3); //Set will qos
			if($this->will['retain'])	$var += 32; //Set will retain
		}

		if($this->username != NULL) $var += 128;	//Add username to header
		if($this->password != NULL) $var += 64;	//Add password to header

		$buffer .= chr($var); $i++;

		//Keep alive
		$buffer .= chr($this->keepalive >> 8); $i++;
		$buffer .= chr($this->keepalive & 0xff); $i++;

		$buffer .= $this->strwritestring($this->clientid,$i);

		//Adding will to payload
		if($this->will != NULL){
			$buffer .= $this->strwritestring($this->will['topic'],$i);  
			$buffer .= $this->strwritestring($this->will['content'],$i);
		}

		if($this->username) $buffer .= $this->strwritestring($this->username,$i);
		if($this->password) $buffer .= $this->strwritestring($this->password,$i);

		$head = "  ";
		$head{0} = chr(0x10);
		$head{1} = chr($i);

		fwrite($this->socket, $head, 2);
		fwrite($this->socket,  $buffer);

	 	$string = $this->read(4);

		if(ord($string{0})>>4 == 2 && $string{3} == chr(0)){
			if($this->debug) echo "Connected to Broker\n"; 
		}else{	
			error_log(sprintf("Connection failed! (Error: 0x%02x 0x%02x)\n", 
			                        ord($string{0}),ord($string{3})));
			return false;
		}

		$this->timesinceping = time();

		return true;
	}

	/* read: reads in so many bytes */
	function read($int = 8192, $nb = false){

		//	print_r(socket_get_status($this->socket));
		
		$string="";
		$togo = $int;
		
		if($nb){
			return fread($this->socket, $togo);
		}
			
		while (!feof($this->socket) && $togo>0) {
			$fread = fread($this->socket, $togo);
			$string .= $fread;
			$togo = $int - strlen($string);
		}
		
	
		
		
			return $string;
	}

	/* subscribe: subscribes to topics */
	function subscribe($topics, $qos = 0){
		$i = 0;
		$buffer = "";
		$id = $this->msgid;
		$buffer .= chr($id >> 8);  $i++;
		$buffer .= chr($id % 256);  $i++;

		foreach($topics as $key => $topic){
			$buffer .= $this->strwritestring($key,$i);
			$buffer .= chr($topic["qos"]);  $i++;
			$this->topics[$key] = $topic; 
		}

		$cmd = 0x80;
		//$qos
		$cmd +=	($qos << 1);


		$head = chr($cmd);
		$head .= chr($i);
		
		fwrite($this->socket, $head, 2);
		fwrite($this->socket, $buffer, $i);
		$string = $this->read(2);
		
		$bytes = ord(substr($string,1,1));
		$string = $this->read($bytes);
	}

	/* ping: sends a keep alive ping */
	function ping(){
			$head = " ";
			$head = chr(0xc0);		
			$head .= chr(0x00);
			fwrite($this->socket, $head, 2);
			if($this->debug) echo "ping sent\n";
	}

	/* disconnect: sends a proper disconect cmd */
	function disconnect(){
			$head = " ";
			$head{0} = chr(0xe0);		
			$head{1} = chr(0x00);
			fwrite($this->socket, $head, 2);
	}

	/* close: sends a proper disconect, then closes the socket */
	function close(){
	 	$this->disconnect();
		fclose($this->socket);	
	}

	/* publish: publishes $content on a $topic */
	function publish($topic, $content, $qos = 0, $retain = 0){

		$i = 0;
		$buffer = "";

		$buffer .= $this->strwritestring($topic,$i);

		//$buffer .= $this->strwritestring($content,$i);

		if($qos){
			$id = $this->msgid++;
			$buffer .= chr($id >> 8);  $i++;
		 	$buffer .= chr($id % 256);  $i++;
		}

		$buffer .= $content;
		$i+=strlen($content);


		$head = " ";
		$cmd = 0x30;
		if($qos) $cmd += $qos << 1;
		if($retain) $cmd += 1;

		$head{0} = chr($cmd);		
		$head .= $this->setmsglength($i);

		fwrite($this->socket, $head, strlen($head));
		fwrite($this->socket, $buffer, $i);

	}

	/* message: processes a recieved topic */
	function message($msg){
		 	$tlen = (ord($msg{0})<<8) + ord($msg{1});
			$topic = substr($msg,2,$tlen);
			$msg = substr($msg,($tlen+2));
			$found = 0;
			foreach($this->topics as $key=>$top){
				if( preg_match("/^".str_replace("#",".*",
						str_replace("+","[^\/]*",
							str_replace("/","\/",
								str_replace("$",'\$',
									$key))))."$/",$topic) ){
					if(function_exists($top['function'])){
						call_user_func($top['function'],$topic,$msg);
						$found = 1;
					}
				}
			}

			if($this->debug && !$found) echo "msg recieved but no match in
subscriptions\n";
	}

	/* proc: the processing loop for an "allways on" client 
		set true when you are doing other stuff in the loop good for watching
something else at the same time */	
	function proc( $loop = true){

		if(1){
			$sockets = array($this->socket);
			$w = $e = NULL;
			$cmd = 0;
			
				//$byte = fgetc($this->socket);
			if(feof($this->socket)){
				if($this->debug) echo "eof receive going to reconnect for good
measure\n";
				fclose($this->socket);
				$this->connect_auto(false);
				if(count($this->topics))
					$this->subscribe($this->topics);	
			}
			
			$byte = $this->read(1, true);
			
			if(!strlen($byte)){
				if($loop){
					usleep(100000);
				}
			 
			}else{ 
			
				$cmd = (int)(ord($byte)/16);
				if($this->debug) echo "Recevid: $cmd\n";

				$multiplier = 1; 
				$value = 0;
				do{
					$digit = ord($this->read(1));
					$value += ($digit & 127) * $multiplier; 
					$multiplier *= 128;
					}while (($digit & 128) != 0);

				if($this->debug) echo "Fetching: $value\n";
				
				if($value)
					$string = $this->read($value,"fetch");
				
				if($cmd){
					switch($cmd){
						case 3:
							$this->message($string);
						break;
					}

					$this->timesinceping = time();
				}
			}

			if($this->timesinceping < (time() - $this->keepalive )){
				if($this->debug) echo "not found something so ping\n";
				$this->ping();	
			}
			

			if($this->timesinceping<(time()-($this->keepalive*2))){
				if($this->debug) echo "not seen a package in a while, disconnecting\n";
				fclose($this->socket);
				$this->connect_auto(false);
				if(count($this->topics))
					$this->subscribe($this->topics);
			}

		}
		return 1;
	}

	/* getmsglength: */
	function getmsglength(&$msg, &$i){

		$multiplier = 1; 
		$value = 0 ;
		do{
		  $digit = ord($msg{$i});
		  $value += ($digit & 127) * $multiplier; 
		  $multiplier *= 128;
		  $i++;
		}while (($digit & 128) != 0);

		return $value;
	}


	/* setmsglength: */
	function setmsglength($len){
		$string = "";
		do{
		  $digit = $len % 128;
		  $len = $len >> 7;
		  // if there are more digits to encode, set the top bit of this digit
		  if ( $len > 0 )
		    $digit = ($digit | 0x80);
		  $string .= chr($digit);
		}while ( $len > 0 );
		return $string;
	}

	/* strwritestring: writes a string to a buffer */
	function strwritestring($str, &$i){
		$ret = " ";
		$len = strlen($str);
		$msb = $len >> 8;
		$lsb = $len % 256;
		$ret = chr($msb);
		$ret .= chr($lsb);
		$ret .= $str;
		$i += ($len+2);
		return $ret;
	}

	function printstr($string){
		$strlen = strlen($string);
			for($j=0;$j<$strlen;$j++){
				$num = ord($string{$j});
				if($num > 31) 
					$chr = $string{$j}; else $chr = " ";
				printf("%4d: %08b : 0x%02x : %s \n",$j,$num,$num,$chr);
			}
	}
}

?>




--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4698437.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ(MQTT) crash when subscribe

Posted by Christopher Shannon <ch...@gmail.com>.
Minor correction...the version in master is 5.12-SNAPSHOT

On Tue, Jun 30, 2015 at 10:39 PM, Christopher Shannon <
christopher.l.shannon@gmail.com> wrote:

> Is the full stack trace in a log file that you could paste?  It would make
> it easier to track down where the out of bounds exception happened.
>
> Also, can you try running against the latest 5.12.0-SNAPSHOT? There's been
> some work done to MQTT over Websockets and I'm wondering if this issue
> still exists against the latest build.
>
> On Mon, Jun 29, 2015 at 4:08 PM, roox_4000 <re...@gmail.com>
> wrote:
>
>> I Download ActiveMQ Broker v5.11.1 And Run It (Use MQTT). I Can Publish
>> And
>> Subscribe With Websocket & PHP For Publish And Broker Work Well.
>>
>> But When Use PHP for subscribe Broker Console Give Me This ERROR And Dont
>> Subscribe Topic
>>
>> WARN : Transport Connection to :tcp://127.0.0.1:18967
>>      failed:java.io.IOExeption:Unexpected error
>>      occurred:java.lang.ArrayIndexOutOfBoundsException :12
>>
>> <http://activemq.2283324.n4.nabble.com/file/n4698367/activemq.jpg>
>>
>> This Error In A loop That Port Error(tcp://127.0.0.1:18967) In Each
>> Period
>> Is Changed
>>
>> Subscribe.php :
>>
>> <?php
>>
>> require("../phpMQTT.php");
>>
>>
>> $mqtt = new phpMQTT("localhost", 1883, "phpMQTT Sub Example"); //Change
>> client name to something unique
>>
>> if(!$mqtt->connect()){
>>     exit(1);
>> }
>>
>> $topics['chat/general'] = array("qos"=>0, "function"=>"procmsg");
>> $mqtt->subscribe($topics,0);
>>
>> while($mqtt->proc()){
>>
>> }
>>
>>
>> $mqtt->close();
>>
>> function procmsg($topic,$msg){
>>         echo "Msg Recieved: ".date("r")."\nTopic:{$topic}\n$msg\n";
>> }
>>
>>
>>
>> ?>
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>