Re: ActiveMQ(MQTT) crash when subscribe
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
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
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 reza.mazar...@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
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.shan...@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 reza.mazar...@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
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
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 and...@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++;
Re: ActiveMQ(MQTT) crash when subscribe
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=1000wireFormat.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=1000wireFormat.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=1000wireFormat.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=1000wireFormat.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=1000wireFormat.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
Re: ActiveMQ(MQTT) crash when subscribe
Minor correction...the version in master is 5.12-SNAPSHOT On Tue, Jun 30, 2015 at 10:39 PM, Christopher Shannon christopher.l.shan...@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 reza.mazar...@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.