Armadilloフォーラム

mosquitto_pub(-l オプション)で1024バイトしか送信出来ない。

yk0515

2018年3月3日 14時06分

■問題点
mosquitto(バージョン 1.3.4 御社提供)環境で、14KB(KBはキロバイト)サイズのメッセージをmosquitto_pub経由で送信するが、1024B分しか送信できない。

mosquitto_pub 起動方法:メッセージを標準入力から受け取る様に”-l”オプションで起動しています。
 mosquitto_pub -h localhost -l -t test/topic

但し、コマンドラインに”-m”オプションでメッセージを組み込むと送信できます。
 mosquitto_pub -h localhost -m "xxxxxxxxxxxxxxxxxxxx" -t test/topic

※ ”-l”オプションを使いたい理由:
網に対して、毎回接続(SYN)を行いたくない為(繋ぎっぱなしで利用したい。)

■動作環境
armadillo-iot G3
mosquitto バージョン 1.3.4

■テスト環境
閉じた環境(ローカルホスト)

お忙しいところ 申し訳ありませんが ご教授の程 宜しくお願い致します。

コメント

at_mizo

2018年3月5日 11時30分

溝渕です。

> ■問題点
> mosquitto(バージョン 1.3.4 御社提供)環境で、14KB(KBはキロバイト)サイズのメッセージをmosquitto_pub経由で送信するが、1024B分しか送信できない。
>
> mosquitto_pub 起動方法:メッセージを標準入力から受け取る様に”-l”オプションで起動しています。
>  mosquitto_pub -h localhost -l -t test/topic

以下の問題に該当しています。

https://bugs.eclipse.org/bugs/show_bug.cgi?id=478917

修正commitは次の通りです。

https://github.com/eclipse/mosquitto.git
commit 89763a51d95e579f0e5d852e2d34a50adababa5d
Author: Roger A. Light
Date: Sun Oct 11 22:55:54 2015 +0100

[478917] Don't truncate lines with "mosquitto_pub -l"

mosquittoのv1.4.5では修正済みですが、jessieにstretchのv1.4.10をバック
ポートするのは恐らく困難です(依存ライブラリ構成に大きな違いがあるため)。

修正commitの内容をv1.3.4に適用するのが近道なのではないかと推測しています。

以上、ご参考になれば。

at_ohsawa

2018年3月5日 14時10分

最新のオリジナルのソースコードを
jessieでビルドするならhttps://github.com/eclipse/mosquitto/issues/496
lws-fixes.patch.txt を当てて1.4.15がビルドできますね。
このissueにもあるようにjessieの環境だとcpu 100%食う問題があるらしいですが…

使ったもの
- 1.4.15のオリジナルのソースコード(https://mosquitto.org/download/)
- debian版の1.4.10のdebian.tar.gz (https://packages.debian.org/source/stable/mosquitto のmosquitto_1.4.10-3.debian.tar.xz )

変更した操作:

- 1.4.15に不要なpatchを除去(allow_ipv6_bridges.patch, mosquitto-1.4.10_cve-2017-7650.patch, build-timestamp.patch)
- changelogsを更新して1.4.15の非メンテナービルドを追記
- contorolのBuild-Dependsからdebhelperのバージョン指定を除外
- lws-fixes.patch.txtを適用

して dpkg-buildpackage -b -us -uc -rfakeroot でオリジナルの改変を無視して
ビルドした1.4.15のパッケージを置いておきます。
上記の操作以外mosquittoの公式ドキュメント
(https://mosquitto.org/blog/2012/11/making-mosquitto-packages-for-debian…)
どおりの手順です。とりあえずコマンドは実行できますが、先のissueの件があるので
at_mizoの言うように必要な機能だけ持ってきた方が良いかもしれません。

インストールは次の順でdpkg -iするとできます。

# dpkg -i  libmosquitto1_1.4.15-1_armhf.deb
# dpkg -i  mosquitto-clients_1.4.15-1_armhf.deb
ファイル ファイルの説明
libmosquitto1_1.4.15-1_armhf.deb
mosquitto-clients_1.4.15-1_armhf.deb
libmosquittopp1_1.4.15-1_armhf.deb