Classic Webcam snapshot picture is not reachable for timelaps

Camera model

Generic USB model - mjpg-streamer

What is the problem?

Live stream and snapshot picture is available, and working ok with the default octoprint-docker (haproxy) configuration. BUT the timelaps uses the same snapshot url (which is available) but it cannot be captured by the timelaps. the following error is introduced:


From the Classic Webcam configuration menu the snapsot url test also fails (but the stream url checker is ok)

What did you already try to solve it?

check the configurations, check for similar topics here and github.

Have you tried running in safe mode?

Yes, but not necessary

Did running in safe mode solve the problem?

No

Systeminfo Bundle

octoprint-systeminfo-20230913024436.zip (700.1 KB)

Additional information about your setup

Octoprint-docker 3.1.0 (default haproxy config) with OctoPrint 1.9.2 (with the new classic webcam implementation)

Tried with multiple config: HostIP (as the docker internal ip's network is bridged), the docker's internal ip, with 'localhost' and also with 127.0.0.1. Explicitly insert the port :80 and without it also. Relative path also not worked.
Here is the header of the snapshot - maybe this is not parsed well by the checker?:
image

It's worth to mention that in the Webcam&Timelaps menu's advanced configuration the 'Timeout' number and 'Snapshot url SSL validation' checkbox can not be modified, the configuration is not saved, a github issue is already opened.

Related timeout error:

2023-09-14T20:14:53.290203256Z 2023-09-14 22:14:53,283 - octoprint.server.api - ERROR - Error while running a test GET request on http://192.168.1.130/webcam/?action=snapshot
2023-09-14T20:14:53.290295238Z Traceback (most recent call last):
2023-09-14T20:14:53.290307042Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 200, in _new_conn
2023-09-14T20:14:53.290317658Z     sock = connection.create_connection(
2023-09-14T20:14:53.290327925Z   File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
2023-09-14T20:14:53.290338191Z     raise err
2023-09-14T20:14:53.290348109Z   File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection
2023-09-14T20:14:53.290358725Z     sock.connect(sa)
2023-09-14T20:14:53.290368433Z socket.timeout: timed out
2023-09-14T20:14:53.290378351Z 
2023-09-14T20:14:53.290388269Z The above exception was the direct cause of the following exception:
2023-09-14T20:14:53.290398396Z 
2023-09-14T20:14:53.290408174Z Traceback (most recent call last):
2023-09-14T20:14:53.290418301Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 790, in urlopen
2023-09-14T20:14:53.290428637Z     response = self._make_request(
2023-09-14T20:14:53.290438695Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 496, in _make_request
2023-09-14T20:14:53.290480111Z     conn.request(
2023-09-14T20:14:53.290490169Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 388, in request
2023-09-14T20:14:53.290500366Z     self.endheaders()
2023-09-14T20:14:53.290510563Z   File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
2023-09-14T20:14:53.290520341Z     self._send_output(message_body, encode_chunked=encode_chunked)
2023-09-14T20:14:53.290530607Z   File "/usr/local/lib/python3.8/http/client.py", line 1011, in _send_output
2023-09-14T20:14:53.290540874Z     self.send(msg)
2023-09-14T20:14:53.290550792Z   File "/usr/local/lib/python3.8/http/client.py", line 951, in send
2023-09-14T20:14:53.290560849Z     self.connect()
2023-09-14T20:14:53.290570487Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 236, in connect
2023-09-14T20:14:53.290580964Z     self.sock = self._new_conn()
2023-09-14T20:14:53.290590812Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 209, in _new_conn
2023-09-14T20:14:53.290601009Z     raise ConnectTimeoutError(
2023-09-14T20:14:53.290611136Z urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f14b524faf0>, 'Connection to 192.168.1.130 timed out. (connect timeout=5.0)')
2023-09-14T20:14:53.290621822Z 
2023-09-14T20:14:53.290631530Z The above exception was the direct cause of the following exception:
2023-09-14T20:14:53.290641098Z 
2023-09-14T20:14:53.290650387Z Traceback (most recent call last):
2023-09-14T20:14:53.290660654Z   File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 486, in send
2023-09-14T20:14:53.290670781Z     resp = conn.urlopen(
2023-09-14T20:14:53.290682864Z   File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 844, in urlopen
2023-09-14T20:14:53.290693340Z     retries = retries.increment(
2023-09-14T20:14:53.290703188Z   File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 515, in increment
2023-09-14T20:14:53.290713385Z     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
2023-09-14T20:14:53.290723582Z urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.130', port=80): Max retries exceeded with url: /webcam/?action=snapshot (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f14b524faf0>, 'Connection to 192.168.1.130 timed out. (connect timeout=5.0)'))
2023-09-14T20:14:53.290734687Z 
2023-09-14T20:14:53.290744185Z During handling of the above exception, another exception occurred:
2023-09-14T20:14:53.290754382Z 
2023-09-14T20:14:53.290764160Z Traceback (most recent call last):
2023-09-14T20:14:53.290774078Z   File "/octoprint/plugins/lib/python3.8/site-packages/octoprint/server/api/__init__.py", line 657, in _test_url
2023-09-14T20:14:53.290784415Z     with requests.request(
2023-09-14T20:14:53.290803132Z   File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 59, in request
2023-09-14T20:14:53.290813748Z     return session.request(method=method, url=url, **kwargs)
2023-09-14T20:14:53.290824365Z   File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
2023-09-14T20:14:53.290834562Z     resp = self.send(prep, **send_kwargs)
2023-09-14T20:14:53.290844409Z   File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 703, in send
2023-09-14T20:14:53.290854606Z     r = adapter.send(request, **kwargs)
2023-09-14T20:14:53.290864594Z   File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 507, in send
2023-09-14T20:14:53.290874651Z     raise ConnectTimeout(e, request=request)
2023-09-14T20:14:53.290884708Z requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.1.130', port=80): Max retries exceeded with url: /webcam/?action=snapshot (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f14b524faf0>, 'Connection to 192.168.1.130 timed out. (connect timeout=5.0)'))

Lession learnt!
I've forgot about the firewall. :smiley:
Firewall was enabled on the host machine, and as the lan is a trusted network I thought it is evident to reach what I want.
But not from docker.... Docker has separated (or bridged) subnet, and it does not enabled to be back-hooked, therefore It can not validate the picture's availability, also timelapse can not reuse it.
Interesting that the stream was also available: since the web interface just embed it on the client browser, and octoprint-docker not reuse it....

1 Like