I have a project that uses the ‘connector’ block to connect data between a sensor that makes its data available on port 7575 and an InfluxDB database. Everything has been working absolutely fine for months, then a couple of days ago after a restart the connector block fails to setup properly with the following error message:
12.03.23 20:04:52 (+0000) connector
12.03.23 20:04:52 (+0000) connector balenaBlocks connector version: 1.1.2
12.03.23 20:04:52 (+0000) connector Changing hostname to c9eb067
12.03.23 20:04:52 (+0000) connector Generating config
12.03.23 20:04:54 (+0000) connector balenablocks/connector
12.03.23 20:04:54 (+0000) connector ----------------------
12.03.23 20:04:54 (+0000) connector Intelligently connecting data sources with data sinks
12.03.23 20:04:55 (+0000) connector Traceback (most recent call last):
12.03.23 20:04:55 (+0000) connector File "/app/./autowire.py", line 96, in <module>
12.03.23 20:04:55 (+0000) connector config = autowire.GetConfig()
12.03.23 20:04:55 (+0000) connector File "/app/./autowire.py", line 62, in GetConfig
12.03.23 20:04:55 (+0000) connector services = self.GetServices()
12.03.23 20:04:55 (+0000) connector File "/app/./autowire.py", line 33, in GetServices
12.03.23 20:04:55 (+0000) connector device = self.balena.models.device.get_with_service_details(device_id, True)
12.03.23 20:04:55 (+0000) connector File "/root/.local/lib/python3.9/site-packages/balena/models/device.py", line 309, in get_with_service_details
12.03.23 20:04:55 (+0000) connector raw_data = self.base_request.request(
12.03.23 20:04:55 (+0000) connector File "/root/.local/lib/python3.9/site-packages/balena/base_request.py", line 197, in request
12.03.23 20:04:55 (+0000) connector raise exceptions.RequestError(response._content)
12.03.23 20:04:55 (+0000) connector balena.exceptions.RequestError: b''
12.03.23 20:04:56 (+0000) Service exited 'connector sha256:3652f9a3f1dc9dd7253dba82b9fac518f78ccd1c874d95c1c25cbc6d190f6768'
I just don’t know why this should happen. I’ve tried loads of things like a an earlier release, different Raspberry Pi4, earlier operating system version but nothing works. Here’s the important sections of my docker compose where you can see the sensor (HMT333) and the InfluxDB sections. I just can’t understand why this should happen when I haven’t changed anything to do with the HMT333 or InfluxDB sections:
hmt333:
privileged: true
build: ./hmt333
restart: always
expose:
- '7575'
volumes:
- 'settings:/data'
influxdb:
image: influxdb@sha256:73f876e0c3bd02900f829d4884f53fdfffd7098dd572406ba549eed955bf821f
container_name: influxdb
restart: always
environment:
- INFLUX_DATA_DIR=/data
- PERSISTENT=1
volumes:
- 'sensor-data:/data'
connector:
image: balenablocks/connector:raspberrypi4-64
restart: always
labels:
io.balena.features.balena-api: '1' # necessary to discover services
io.balena.features.supervisor-api: 1 # necessary to discover services in local mode
privileged: true # necessary to change container hostname
depends_on:
- influxdb
- hmt333
I’ve tried creating a new device etc. but same problem. Note that the ‘connector’ section in my docker compose doesn’t point to ‘bh.cr/balenalabs/connector-aarch64’ as that still has a ‘ModuleNotFound’ issue open which still exists on the Raspberry Pi4.
I wonder if I’m correct in thinking that this error means the connector block is not getting a response from the sensor (HMT333)? I can see that data is being received from the sensor though. I do also have another device in this fleet which is running fine but it hasn’t rebooted for a long time. On that device I see this log message frequently:
12.03.23 20:31:40 (+0000) hmt333 172.17.0.8 - - [12/Mar/2023 20:31:40] "GET / HTTP/1.1" 200 -
Which I think is the connector block getting data from the sensor, obviously I’m not seeing this now as the connector block isn’t starting up.
To test, I also setup this project for a Raspberry Pi3 as well - exactly the same error, though it says the version of connector is 1.1.6
The Python code snippet is what I use to serve my sensor data and I do get a log message to say the service has started up - this has always worked fine anyway:
while True:
server_address = ('', 7575)
httpd = HTTPServer(server_address, HMT333http)
logging.info('HMT333 sensor HTTP server running')
httpd.serve_forever()
I see this in the GitHub README for connector (might be worth me increasing the timeout?)
The default timeout for retrieving data is 2 seconds. You can change this by setting
INTERNAL_HTTP_TIMEOUT
to the number of seconds (e.g.4
)
Though this has never been a problem before.
Grateful for any ideas, I just don’t know what else to try now.
Thanks
Mark.