danielkucera / epaper-station

57 stars 8 forks source link

Unable to prepare image data for client #3

Open pklosko opened 2 years ago

pklosko commented 2 years ago

Info k https://twitter.com/pklosko/status/1476478308028141576?s=20

Po cca 16h provozu "Unable to prepare image data for client"

Prostredi: RPiOS, buster@RPiZero Linux ZigBeeGate 5.10.63+ #1496 Wed Dec 1 15:57:05 GMT 2021 armv6l GNU/Linux start ststion.py from rc.local cd /home/pi/epaper-station/; /usr/bin/python3 ./station.py&

Get image from web , periodicaly by CRON /5 * ... wget -q -O /path/to/mac.png "https://myweb/epaper-png.php"

Toto jsem nalezl v logu:

cat daemon.log | grep rc.local | grep "Dec 30 09" | head -20 Dec 30 09:09:48 ZigBeeGate rc.local[394]: 2021-12-30 09:09:48,629 Got checkin request Dec 30 09:09:48 ZigBeeGate rc.local[394]: 2021-12-30 09:09:48,637 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2870, lastPacketLQI=33, lastPacketRSSI=179, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 09:09:48 ZigBeeGate rc.local[394]: 2021-12-30 09:09:48,639 Reading image file: c8ba94ff0130ca12.png Dec 30 09:09:49 ZigBeeGate rc.local[394]: 2021-12-30 09:09:49,369 Unable to prepare image data for client [200, 186, 148, 255, 1, 48, 202, 18] Dec 30 09:09:49 ZigBeeGate rc.local[394]: 2021-12-30 09:09:49,378 cannot identify image file <_io.BytesIO object at 0xb5c41900> Dec 30 09:09:49 ZigBeeGate rc.local[394]: 2021-12-30 09:09:49,389 Got checkin request Dec 30 09:09:49 ZigBeeGate rc.local[394]: 2021-12-30 09:09:49,390 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2740, lastPacketLQI=33, lastPacketRSSI=179, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 09:09:49 ZigBeeGate rc.local[394]: 2021-12-30 09:09:49,405 Reading image file: c8ba94ff0130ca12.png .... cat daemon.log | grep rc.local | grep "Dec 30 10" | head -20 Dec 30 10:36:11 ZigBeeGate rc.local[394]: 2021-12-30 10:36:11,127 Reading image file: c8ba94ff0130ca12.png Dec 30 10:36:11 ZigBeeGate rc.local[394]: 2021-12-30 10:36:11,142 Unable to prepare image data for client [200, 186, 148, 255, 1, 48, 202, 18] Dec 30 10:36:11 ZigBeeGate rc.local[394]: 2021-12-30 10:36:11,143 cannot identify image file <_io.BytesIO object at 0xb5a98450> ... cat daemon.log | grep rc.local | grep "Dec 30 11" | head -20 Dec 30 11:04:50 ZigBeeGate rc.local[394]: 2021-12-30 11:04:50,916 Got checkin request Dec 30 11:04:50 ZigBeeGate rc.local[394]: 2021-12-30 11:04:50,928 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2870, lastPacketLQI=0, lastPacketRSSI=0, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 11:04:50 ZigBeeGate rc.local[394]: 2021-12-30 11:04:50,930 Reading image file: c8ba94ff0130ca12.png Dec 30 11:04:51 ZigBeeGate rc.local[394]: 2021-12-30 11:04:51,004 PendingInfo(imgUpdateVer=4051434760, imgUpdateSize=15662, osUpdateVer=1099511627785, osUpdateSize=0, nextCheckinDelay=0, rfu=bytearray(b'\x00\x00\x00\x00')) Dec 30 11:04:51 ZigBeeGate rc.local[394]: 2021-12-30 11:04:51,101 Got checkin request Dec 30 11:04:51 ZigBeeGate rc.local[394]: 2021-12-30 11:04:51,108 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2720, lastPacketLQI=0, lastPacketRSSI=0, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 11:04:51 ZigBeeGate rc.local[394]: 2021-12-30 11:04:51,109 Reading image file: c8ba94ff0130ca12.png Dec 30 11:04:51 ZigBeeGate rc.local[394]: 2021-12-30 11:04:51,116 PendingInfo(imgUpdateVer=4051434760, imgUpdateSize=15662, osUpdateVer=1099511627785, osUpdateSize=0, nextCheckinDelay=0, rfu=bytearray(b'\x00\x00\x00\x00')) Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,146 Got checkin request Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,158 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2860, lastPacketLQI=43, lastPacketRSSI=183, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,160 Reading image file: c8ba94ff0130ca12.png Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,224 PendingInfo(imgUpdateVer=3623677153, imgUpdateSize=15662, osUpdateVer=1099511627785, osUpdateSize=0, nextCheckinDelay=0, rfu=bytearray(b'\x00\x00\x00\x00')) Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,331 Got checkin request Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,338 CheckinInfo(swVer=1099511627785, hwType=1, batteryMv=2730, lastPacketLQI=43, lastPacketRSSI=183, temperature=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,339 Reading image file: c8ba94ff0130ca12.png Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,352 PendingInfo(imgUpdateVer=3623677153, imgUpdateSize=15662, osUpdateVer=1099511627785, osUpdateSize=0, nextCheckinDelay=0, rfu=bytearray(b'\x00\x00\x00\x00')) Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,598 Got chunk request Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,605 ChunkReqInfo(versionRequested=3623677153, offset=0, len=88, osUpdatePlz=0, rfu=b'\x00\x00\x00\x00\x00\x00') Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,612 ChunkInfo(offset=0, osUpdatePlz=0, rfu=0) Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,613 Reading image file: /tmp/3623677153.bmp Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,615 sending chunk 95 f5000000000000424d2e ... Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,680 Got chunk request Dec 30 11:33:43 ZigBeeGate rc.local[394]: 2021-12-30 11:33:43,686 ChunkReqInfo(versionRequested=3623677153, offset=88, len=88, osUpdatePlz=0, rfu=b'\x00\x00\x00\x00\x00\x00')

danielkucera commented 2 years ago

Si si isty ze to bol validny obrazok? Mohlo sa to nespravne wget-nut? Mas logy z toho webserveru?

pklosko commented 2 years ago

Nevylucuju to, ale jak tak koukam do logu na webserveru tak je tam vse OK

pklosko commented 2 years ago

Jeste mne napada jedna vec. Koukam do logu a ten Checkin request prijde vzdy 2x velmi rychle po sobe (otazka PROC?)

Jan 3 00:53:04 ZigBeeGate rc.local[396]: 2022-01-03 00:53:04,238 Got checkin request Jan 3 00:53:04 ZigBeeGate rc.local[396]: 2022-01-03 00:53:04,423 Got checkin request Jan 3 01:22:10 ZigBeeGate rc.local[396]: 2022-01-03 01:22:10,708 Got checkin request Jan 3 01:22:10 ZigBeeGate rc.local[396]: 2022-01-03 01:22:10,892 Got checkin request Jan 3 01:51:04 ZigBeeGate rc.local[396]: 2022-01-03 01:51:04,124 Got checkin request Jan 3 01:51:04 ZigBeeGate rc.local[396]: 2022-01-03 01:51:04,310 Got checkin request Jan 3 02:19:57 ZigBeeGate rc.local[396]: 2022-01-03 02:19:57,666 Got checkin request Jan 3 02:19:57 ZigBeeGate rc.local[396]: 2022-01-03 02:19:57,850 Got checkin request Jan 3 02:48:50 ZigBeeGate rc.local[396]: 2022-01-03 02:48:50,610 Got checkin request Jan 3 02:48:50 ZigBeeGate rc.local[396]: 2022-01-03 02:48:50,795 Got checkin request Jan 3 03:17:44 ZigBeeGate rc.local[396]: 2022-01-03 03:17:44,155 Got checkin request Jan 3 03:17:44 ZigBeeGate rc.local[396]: 2022-01-03 03:17:44,341 Got checkin request Jan 3 03:46:37 ZigBeeGate rc.local[396]: 2022-01-03 03:46:37,958 Got checkin request Jan 3 04:15:32 ZigBeeGate rc.local[396]: 2022-01-03 04:15:32,020 Got checkin request Jan 3 04:15:32 ZigBeeGate rc.local[396]: 2022-01-03 04:15:32,205 Got checkin request Jan 3 04:44:25 ZigBeeGate rc.local[396]: 2022-01-03 04:44:25,612 Got checkin request Jan 3 04:44:25 ZigBeeGate rc.local[396]: 2022-01-03 04:44:25,797 Got checkin request Jan 3 05:13:19 ZigBeeGate rc.local[396]: 2022-01-03 05:13:19,556 Got checkin request Jan 3 05:13:19 ZigBeeGate rc.local[396]: 2022-01-03 05:13:19,741 Got checkin request Jan 3 05:42:13 ZigBeeGate rc.local[396]: 2022-01-03 05:42:13,115 Got checkin request Jan 3 05:42:13 ZigBeeGate rc.local[396]: 2022-01-03 05:42:13,300 Got checkin request Jan 3 06:11:07 ZigBeeGate rc.local[396]: 2022-01-03 06:11:07,049 Got checkin request Jan 3 06:11:07 ZigBeeGate rc.local[396]: 2022-01-03 06:11:07,728 Got checkin request

Jestli tohle nemuze zpusobit nejaky IO block (pomala SD karta ???)

No kazdopadne mi ty dva requesty po sobe delaji problemy s mojim hackem IoTgetImage(url) v prepare_image() => posle 2x PendingInfo paket se stejnym imgUpdateVer = imgVer Takze to zatim ohybam pres timestamp

danielkucera commented 2 years ago

No nie je to uplne optimalne navrhnute, priznavam, station uz by mal vediet aky obrazok posle este pred tym ako pride request, je tam iba 100ms na odpoved a niektore systemy to nemusia stihat. https://github.com/danielkucera/epaper-firmware/blob/305648a2382df521ed7eeac52053d172e5c0800f/solum_BW_4.2_fw/comms.h#L14

pklosko commented 2 years ago

hmmm, ten HTTP tam bude bottleneck, zvlast na pomalejsi lince Uz jsem koukal i do main.c = tam je to (for i=0; i<5 && checkinJeFalse ) ... to bude duvod 2 a vice checkin paketu

zkusim to nejak "asynchronne na request"

pklosko commented 2 years ago

Ahoj, tak konecne funkcni "asynchronni" verze https://github.com/pklosko/epaper-station