1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pythonのmilkcocoa SDKで数時間で通信エラー

Posted at

概要

3時間ほど経過すると、下記のような例外を吐いて止まってしまう。。
モバイルルータの問題なのかlinuxのWifiの設定なのかpythonのコードの問題なのかが切り分けられないのだけど、似たような報告↓があるので既知の問題を踏んでいる?

pythonでsendを使ってデータ送信を行う際のエラーについて
https://teratail.com/questions/21990

例外

  File "/home/t/servo/hat/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/python_sdk/milkcocoa/milkcocoa.py", line 63, in connectWithApiKey
    return Milkcocoa(app_id, "k" + key + ":" + secret, useSSL=useSSL, blocking=blocking)
  File "/home/t/servo/hat/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/python_sdk/milkcocoa/milkcocoa.py", line 31, in __init__
    self.client.connect(self.host, port, 36)
  File "/home/t/servo/hat/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/python_sdk/milkcocoa/paho/mqtt/client.py", line 612, in connect
    return self.reconnect()
  File "/home/t/servo/hat/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/python_sdk/milkcocoa/paho/mqtt/client.py", line 734, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 110] Connection timed out
Exception in thread Thread-361 (most likely raised during interpreter shutdown):Exception in thread Thread-428 (most likely raised during interpreter shutdown):Exception in thread Thread-340 (most likely raised during interpreter shutdown):Exception in thread Thread-398 (most likely raised during interpreter shutdown):

切り分け1

So-netの0SIMを使って試していたのだけど、どういう振る舞いなのかアヤシイのでsoracomのSIMに差し替えて試験しても再発した、のでSIMではない。

14時台に通信がないのがSORACOMのUser consoleで見るとわかる。SORACOM便利。
image

例外拾って再接続処理入れた

再接続しようとしまくってパケ死するとこだった・・・速度制限するようにしてたから良かったけどSORACOM怖い。

いったん切断されても、パケット自体は流れているみたいなのでpythonのpahoかmilkcocoa SDKの問題?

image

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?