sskaje / mqtt

MQTT Client class
https://sskaje.me/category/MQTT/
MIT License
86 stars 33 forks source link

the new v2.0 can not use in product env #19

Open w3yyb opened 7 years ago

w3yyb commented 7 years ago

In the high load env, the v2.0 often report the following error: fwrite(): send of 2 bytes failed with errno=32 Broken pipe file:

but the old v1.0 can work well Basically.

sskaje commented 7 years ago

How to reproduce and where this fwrite error occurs ?

w3yyb commented 7 years ago

PHP Notice: fwrite(): send of 2 bytes failed with errno=32 Broken pipe in /var/www/html/phalconapi/app/library/mqtt/SocketClient.php on line 166

w3yyb commented 7 years ago

code: $cpush = new MQTT('tcp://'.$config->host.':'.$config->port.'/', $pclientid); $context = stream_context_create(); $cpush->setSocketContext($context); $cpush->setVersion(MQTT::VERSION_3_1_1); $cpush->setKeepalive(60); $cpush->setConnectClean(true); $connected = $cpush->connect(); $cpush->setRetryTimeout(5); $myhandler = new \MyPublishHandler(); $pushed = $cpush->publish_async($json->Subject, $content, $config->qos, $config->retain,$msgid);
$myhandler->waitQueue[$pushed['msgid']] = $pushed; $cpush->setHandler($myhandler); $cpush->loop();

w3yyb commented 7 years ago

and often throw new Exception('WTFFFFFF!!!! '); too. in MQTT.php 1285行.

nielsenaa commented 7 years ago

Hi guys,

i also get thrown at the wtf exception in MQTT.php; i seems it depends on message specific content char combination being sent on publish (i am using qos2 async) i pass alot of ESC chars in there and on specific conditions, exception fires up.. i doesnt seem to be affected by overall payload length / "size".. can reproduce but cannot debug for sure !

sskaje commented 7 years ago

@nielsenaa please give me a copy of your message

nielsenaa commented 7 years ago

Hello Sskaje!

want some other kind of message that doesn’t fire exception ?

Thank you !

nielsenaa commented 7 years ago

care to chat ? @nielsenaa on skype