dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

RaspberryPi/arm - Edit page causes 500 error - glibc mismatch with jq #1917

Closed mschoettle closed 11 months ago

mschoettle commented 11 months ago

Describe the bug

When clicking "edit" on the home screen to edit a specific change detection watch an internal server error (500) is shown.

Version 0.45.5

Self-hosted on Raspberry Pi 4 as a container

To Reproduce

Steps to reproduce the behavior:

  1. Create a watch
  2. Edit the watch

Expected behavior

Open the edit page for the watch

Additional context

Logs:

changedetection-app-1  | ERROR:changedetectionio:Exception on /edit/ec87affe-4945-4451-9be1-207e070e6d21 [GET]
changedetection-app-1  | Traceback (most recent call last):
changedetection-app-1  |   File "/usr/local/flask/app.py", line 2073, in wsgi_app
changedetection-app-1  |     response = self.full_dispatch_request()
changedetection-app-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/usr/local/flask/app.py", line 1519, in full_dispatch_request
changedetection-app-1  |     rv = self.handle_user_exception(e)
changedetection-app-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/usr/local/flask_restful/__init__.py", line 298, in error_router
changedetection-app-1  |     return original_handler(e)
changedetection-app-1  |            ^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/usr/local/flask/app.py", line 1517, in full_dispatch_request
changedetection-app-1  |     rv = self.dispatch_request()
changedetection-app-1  |          ^^^^^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/usr/local/flask/app.py", line 1503, in dispatch_request
changedetection-app-1  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
changedetection-app-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/app/changedetectionio/__init__.py", line 208, in decorated_view
changedetection-app-1  |     return func(*args, **kwargs)
changedetection-app-1  |            ^^^^^^^^^^^^^^^^^^^^^
changedetection-app-1  |   File "/app/changedetectionio/__init__.py", line 705, in edit_page
changedetection-app-1  |     import jq
changedetection-app-1  | ImportError: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.35' not found (required by /usr/local/jq.cpython-311-arm-linux-gnueabihf.so)
changedetection-app-1  | 192.168.1.203,172.23.0.3 - - [30/Oct/2023 16:23:52] "GET /edit/ec87affe-4945-4451-9be1-207e070e6d21 HTTP/1.1" 500 449 0.019137

Happens on import of jq:

>>> import jq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.35' not found (required by /usr/local/jq.cpython-311-arm-linux-gnueabihf.so)

Potential solution:

With the -bookworm variant of the Python image the correct glibc version is used and importing jq works without problems.

dgtlmoon commented 11 months ago

@mschoettle thanks for the report, could you please add this debug info..

python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-6.2.0-34-generic-x86_64-with-glibc2.35'
>>> 
>>> platform.system()
'Linux'
>>> 

What do you get?

This may be related to https://github.com/dgtlmoon/changedetection.io/pull/1772

mschoettle commented 11 months ago

Here's the requested info:

python
Python 3.11.6 (main, Oct 11 2023, 22:42:26) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-5.10.103-v7l+-armv7l-with-glibc2.31'
>>> platform.system()
'Linux'
dgtlmoon commented 11 months ago

@mschoettle sorry I forgot to ask, can you run that python output from inside the docker container changedetection-app-1 ?

dgtlmoon commented 11 months ago

ahh I see https://www.debian.org/releases/bookworm/ Debian 12.2 was released on October 7th, 2023.

mschoettle commented 11 months ago

That was run in the container. I was in the process to also give you the output with the bookworm image but I see you already created a PR to switch to that variant 👍 Thanks!

mschoettle commented 11 months ago
docker run --rm -it python:3.11-slim-bookworm bash
root@57799a059155:/# apt-get update && apt-get install -y --no-install-recommends \
    g++ \
    gcc \
    libc-dev \
    libffi-dev \
    libjpeg-dev \
    libssl-dev \
    libxslt-dev \
    make \
    zlib1g-dev

pip install jq

python
Python 3.11.6 (main, Oct 11 2023, 22:27:41) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-5.10.103-v7l+-armv7l-with-glibc2.36'
>>> platform.system()
'Linux'
>>> import jq
>>> 
dgtlmoon commented 11 months ago

I'de dearly love to find a way to execute some basic tests in some kind of arm architecture virtualmachine via github actions...

dgtlmoon commented 11 months ago

btw: does the watch you're editing include some filters? (jq, xpath, css etc?)

dgtlmoon commented 11 months ago

python:3.11-slim-bookworm AMD64 does not have libssl but has libssl3 or similar

ARMv7 prefers libssl

> [linux/amd64 stage-1 2/8] RUN apt-get update && apt-get install -y --no-install-14.77 ...
E: Unable to locate package libssl

so which libssl do both ARMv6/7 and AMD64 have? :D https://github.com/dgtlmoon/changedetection.io/actions/runs/6696119882/job/18193184793

or do we need to switch the 'apt-get install libssl` depending on the architecture? or leave it out? i wonder

dgtlmoon commented 11 months ago

@mschoettle please, try this on master and 1917-glibc-mistmatch-arm-upgrade-bookworm in your rPi, master should fail.. hopefully and the other pass

git clone https://github.com/dgtlmoon/changedetection.io.git
cd changedetection.io.git
git checkout (master or 1917...)
docker build . -t test-changedetectionio
docker run  test-changedetectionio  bash -c 'echo 127.0.0.1 localhost.localdomain >> /etc/hosts; cd changedetectionio && pytest tests/test_jsonpath_jq_selector.py'
Constantin1489 commented 11 months ago

docker build https://github.com/dgtlmoon/changedetection.io.git#1917-glibc-mistmatch-arm-upgrade-bookworm -t test-changedetectionio

https://stackoverflow.com/a/48197239/20307768

dgtlmoon commented 11 months ago

docker build https://github.com/dgtlmoon/changedetection.io.git#1917-glibc-mistmatch-arm-upgrade-bookworm -t test-changedetectionio

https://stackoverflow.com/a/48197239/20307768

that is truly amazing! cool!

mschoettle commented 11 months ago

btw: does the watch you're editing include some filters? (jq, xpath, css etc?)

No.

@Constantin1489 Thanks for that neat trick!

@dgtlmoon I can confirm that 917-glibc-mistmatch-arm-upgrade-bookwor works. And that it fails on master.

dgtlmoon commented 11 months ago

@mschoettle this tag image should solve it, can you verify once more for me? https://hub.docker.com/layers/dgtlmoon/changedetection.io/dev/images/sha256-efff743e8d0de249bf4af201c985cbe9b7715a616545bb64f18913391c9fb309?context=explore

mschoettle commented 11 months ago

I can confirm that dgtlmoon/changedetection.io:dev works on Raspberry Pi. Thanks again!