Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird error re fonts #89

Closed
patroqueeet opened this issue Jun 15, 2023 · 12 comments
Closed

Weird error re fonts #89

patroqueeet opened this issue Jun 15, 2023 · 12 comments

Comments

@patroqueeet
Copy link

dear, my pdf assertion tests started failing today. stack is chrome, chromedriver, puppeteer. I checked the stack and the only thing changed since yesterday is your update to tag python3.10-nodejs16-slim in docker. I checked your commits and see no reason why this is failing. the assertion error in the tests is related to fonts. any idea?

@nikolaik
Copy link
Owner

dear, my pdf assertion tests started failing today. stack is chrome, chromedriver, puppeteer. I checked the stack and the only thing changed since yesterday is your update to tag python3.10-nodejs16-slim in docker. I checked your commits and see no reason why this is failing. the assertion error in the tests is related to fonts. any idea?

Oouf, not good! Can you share the test code with the assert and a backtrace? I'm thinking it could either be a cache issue on ci or some font related package Debian upstream that changed in a breaking fashion.

@patroqueeet
Copy link
Author

patroqueeet commented Jun 15, 2023

not really, because this exception happens when pixel wise comparing pdfs (new and ref). when inspecting the diff manually I found fonts display differently and utf8 chars don't display at all. precisely: ⚠ is not showing anymore in an email template rendered to pdf. I already tested puppeteer versions (all failing) as well as checked if chrome(driver) versions changed (didn't). pdfs rendered via phantomJS or xhtml2pdf don't fail.

Do you have an idea how we/I could narrow down the source of the failure?

@nikolaik
Copy link
Owner

Can you pin the old image sha to verify that the new version of the image causes the regression?

That utf8 characters in fonts are suddenly missing with puppeteer rendering could indicate that something font related changed in the Debian slim base image

@patroqueeet
Copy link
Author

@patroqueeet
Copy link
Author

like that? FROM nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:96a3e0bc4d30e93aeb8b11cbb732c46c9f560fde84d53be440143161fcff9bee

@patroqueeet
Copy link
Author

I can confirm that with sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957 the tests pass.

@nikolaik
Copy link
Owner

nikolaik commented Jun 19, 2023

You can pin that image sha as a workaround, but not sure how to solve your concrete issue without more details.

I did a bit of digging and found that the python base image was was updated to debian bookworm ref docker-library/official-images#14854

# old
$ docker run -it nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957 grep VERSION /etc/os-release
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
# new 
$ docker run -it nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:e44c450085a2a115d38ffa7f3a1cebde287501fadce2bc4843e84d4231f2df62 grep VERSION /etc/os-release
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm

This means quite a few packages recieve updates that are potentially breaking. Using container-diff we can see the changed packages (NB: had to build using this PR):

$ ./container-diff diff nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957 nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:e44c450085a2a115d38ffa7f3a1cebde287501fadce2bc4843e84d4231f2df62 --type apt

-----Apt-----

Packages found only in nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957:
NAME                         VERSION                      SIZE
-gcc-10-base                 10.2.1-6                     261K
-gcc-9-base                  9.3.0-22                     262K
-libffi7                     3.3-6                        66K
-libldap-2.4-2               2.4.57 dfsg-3+deb11u1        539K
-libmpdec3                   2.5.1-1                      278K
-libpcre3                    2:8.39-13                    669K
-libpython3.9-minimal        3.9.2-1                      4.8M
-libpython3.9-stdlib         3.9.2-1                      7.7M
-libsemanage1                3.1-1 b2                     307K
-libsepol1                   3.1-1                        743K
-libssl1.1                   1.1.1n-0 deb11u5             4M
-lsb-base                    11.1.0                       49K
-python3.9                   3.9.2-1                      541K
-python3.9-minimal           3.9.2-1                      5.3M

Packages found only in nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:e44c450085a2a115d38ffa7f3a1cebde287501fadce2bc4843e84d4231f2df62:
NAME                          VERSION              SIZE
-gcc-12-base                  12.2.0-14            100K
-libc-dev-bin                 2.36-9               90K
-libc6-dev                    2.36-9               11.7M
-libcap2                      1:2.66-4             94K
-libcrypt-dev                 1:4.4.33-2           341K
-libffi8                      3.4.4-1              68K
-libldap-2.5-0                2.5.13 dfsg-5        553K
-libmd0                       1.0.4-2              79K
-libnsl-dev                   1.3.0-2              345K
-libpython3.11-minimal        3.11.2-6             5.1M
-libpython3.11-stdlib         3.11.2-6             8.1M
-libsemanage2                 3.4-1 b5             297K
-libsepol2                    3.4-2.1              775K
-libssl3                      3.0.9-1              5.9M
-libtirpc-dev                 1.3.3 ds-1           717K
-linux-libc-dev               6.1.27-1             6.4M
-python3.11                   3.11.2-6             648K
-python3.11-minimal           3.11.2-6             6.6M
-rpcsvc-proto                 1.4.3-1              246K
-usr-is-merged                35                   11K
-util-linux-extra             2.38.1-5 b1          367K

Version differences:
PACKAGE                        IMAGE1 (nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957)        IMAGE2 (nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:e44c450085a2a115d38ffa7f3a1cebde287501fadce2bc4843e84d4231f2df62)
-adduser                       3.118, 849K                                                                                                                             3.134, 686K
-apt                           2.2.4, 4.2M                                                                                                                             2.6.1, 4.1M
-base-files                    11.1 deb11u7, 341K                                                                                                                      12.4, 341K
-base-passwd                   3.5.51, 243K                                                                                                                            3.6.1, 247K
-bash                          5.1-2 deb11u1, 6.3M                                                                                                                     5.2.15-2 b2, 7M
-bsdutils                      1:2.36.1-8 deb11u1, 394K                                                                                                                1:2.38.1-5 b1, 356K
-ca-certificates               20210119, 382K                                                                                                                          20230311, 384K
-coreutils                     8.32-4 b1, 17.1M                                                                                                                        9.1-1, 17.6M
-dash                          0.5.11 git20200708+dd9ef66-5, 221K                                                                                                      0.5.12-2, 191K
-debconf                       1.5.77, 517K                                                                                                                            1.5.82, 491K
-debian-archive-keyring        2021.1.1 deb11u1, 253K                                                                                                                  2023.3, 270K
-debianutils                   4.11.2, 230K                                                                                                                            5.7-0.4, 243K
-diffutils                     1:3.7-5, 1.6M                                                                                                                           1:3.8-4, 1.6M
-dirmngr                       2.2.27-2 deb11u2, 1.2M                                                                                                                  2.2.40-1.1, 1.3M
-dpkg                          1.20.12, 6.8M                                                                                                                           1.21.22, 6.3M
-e2fsprogs                     1.46.2-2, 1.5M                                                                                                                          1.47.0-2, 1.5M
-findutils                     4.8.0-1, 1.9M                                                                                                                           4.9.0-4, 1.7M
-gnupg                         2.2.27-2 deb11u2, 864K                                                                                                                  2.2.40-1.1, 885K
-gnupg-l10n                    2.2.27-2 deb11u2, 4.8M                                                                                                                  2.2.40-1.1, 4.8M
-gnupg-utils                   2.2.27-2 deb11u2, 1.8M                                                                                                                  2.2.40-1.1, 1.8M
-gnupg2                        2.2.27-2 deb11u2, 442K                                                                                                                  2.2.40-1.1, 453K
-gpg                           2.2.27-2 deb11u2, 1.5M                                                                                                                  2.2.40-1.1, 1.5M
-gpg-agent                     2.2.27-2 deb11u2, 1.3M                                                                                                                  2.2.40-1.1, 1.3M
-gpg-wks-client                2.2.27-2 deb11u2, 658K                                                                                                                  2.2.40-1.1, 682K
-gpg-wks-server                2.2.27-2 deb11u2, 634K                                                                                                                  2.2.40-1.1, 657K
-gpgconf                       2.2.27-2 deb11u2, 771K                                                                                                                  2.2.40-1.1, 803K
-gpgsm                         2.2.27-2 deb11u2, 951K                                                                                                                  2.2.40-1.1, 992K
-gpgv                          2.2.27-2 deb11u2, 882K                                                                                                                  2.2.40-1.1, 917K
-grep                          3.6-1 deb11u1, 1.1M                                                                                                                     3.8-5, 1.2M
-gzip                          1.10-4 deb11u1, 242K                                                                                                                    1.12-1, 252K
-hostname                      3.23, 50K                                                                                                                               3.23 nmu1, 46K
-init-system-helpers           1.60, 131K                                                                                                                              1.65.2, 140K
-libacl1                       2.2.53-10, 71K                                                                                                                          2.3.1-3, 73K
-libapt-pkg6.0                 2.2.4, 3.3M                                                                                                                             2.6.1, 3.2M
-libassuan0                    2.5.3-7.1, 121K                                                                                                                         2.5.5-5, 117K
-libattr1                      1:2.4.48-6, 56K                                                                                                                         1:2.5.1-4, 59K
-libaudit-common               1:3.0-2, 26K                                                                                                                            1:3.0.9-1, 22K
-libaudit1                     1:3.0-2, 154K                                                                                                                           1:3.0.9-1, 150K
-libblkid1                     2.36.1-8 deb11u1, 421K                                                                                                                  2.38.1-5 b1, 399K
-libbz2-1.0                    1.0.8-4, 104K                                                                                                                           1.0.8-5 b1, 106K
-libc-bin                      2.31-13 deb11u6, 3.6M                                                                                                                   2.36-9, 2M
-libc6                         2.31-13 deb11u6, 12.5M                                                                                                                  2.36-9, 12.7M
-libcap-ng0                    0.7.9-2.2 b1, 48K                                                                                                                       0.8.3-1 b3, 65K
-libcom-err2                   1.46.2-2, 97K                                                                                                                           1.47.0-2, 54K
-libcrypt1                     1:4.4.18-4, 226K                                                                                                                        1:4.4.33-2, 233K
-libdb5.3                      5.3.28 dfsg1-0.8, 1.8M                                                                                                                  5.3.28 dfsg2-1, 1.8M
-libdebconfclient0             0.260, 74K                                                                                                                              0.270, 37K
-libexpat1                     2.2.10-2 deb11u5, 411K                                                                                                                  2.5.0-1, 387K
-libext2fs2                    1.46.2-2, 578K                                                                                                                          1.47.0-2, 534K
-libgcc-s1                     10.2.1-6, 116K                                                                                                                          12.2.0-14, 140K
-libgcrypt20                   1.8.7-6, 1.3M                                                                                                                           1.10.1-3, 1.6M
-libgdbm6                      1.19-2, 114K                                                                                                                            1.23-3, 129K
-libgmp10                      2:6.2.1 dfsg-1+deb11u1, 863K                                                                                                            2:6.2.1 dfsg1-1.1, 855K
-libgnutls30                   3.7.1-5 deb11u3, 3.1M                                                                                                                   3.7.9-2, 3.3M
-libgpg-error0                 1.38-2, 188K                                                                                                                            1.46-1, 192K
-libgssapi-krb5-2              1.18.3-6 deb11u3, 451K                                                                                                                  1.20.1-2, 420K
-libhogweed6                   3.7.3-1, 455K                                                                                                                           3.8.1-2, 463K
-libidn2-0                     2.3.0-5, 300K                                                                                                                           2.3.3-1 b1, 439K
-libk5crypto3                  1.18.3-6 deb11u3, 296K                                                                                                                  1.20.1-2, 260K
-libkeyutils1                  1.6.1-2, 46K                                                                                                                            1.6.3-2, 40K
-libkrb5-3                     1.18.3-6 deb11u3, 1.1M                                                                                                                  1.20.1-2, 1.1M
-libkrb5support0               1.18.3-6 deb11u3, 169K                                                                                                                  1.20.1-2, 133K
-libksba8                      1.5.0-3 deb11u2, 308K                                                                                                                   1.6.3-2, 316K
-libldap-common                2.4.57 dfsg-3+deb11u1, 119K                                                                                                             2.5.13 dfsg-5, 92K
-liblz4-1                      1.9.3-2, 157K                                                                                                                           1.9.4-1, 169K
-liblzma5                      5.2.5-2.1~deb11u1, 277K                                                                                                                 5.4.1-0.2, 333K
-libmount1                     2.36.1-8 deb11u1, 477K                                                                                                                  2.38.1-5 b1, 455K
-libncursesw6                  6.2 20201114-2+deb11u1, 420K                                                                                                            6.4-4, 412K
-libnettle8                    3.7.3-1, 480K                                                                                                                           3.8.1-2, 520K
-libp11-kit0                   0.23.22-1, 1.4M                                                                                                                         0.24.1-2, 1.4M
-libpam-modules                1.4.0-9 deb11u1, 1M                                                                                                                     1.5.2-6, 1M
-libpam-modules-bin            1.4.0-9 deb11u1, 227K                                                                                                                   1.5.2-6, 227K
-libpam-runtime                1.4.0-9 deb11u1, 965K                                                                                                                   1.5.2-6, 876K
-libpam0g                      1.4.0-9 deb11u1, 244K                                                                                                                   1.5.2-6, 215K
-libpcre2-8-0                  10.36-2 deb11u1, 664K                                                                                                                   10.42-1, 685K
-libpsl5                       0.21.0-1.2, 95K                                                                                                                         0.21.2-1, 96K
-libreadline8                  8.1-1, 471K                                                                                                                             8.2-1.3, 475K
-libsasl2-2                    2.1.27 dfsg-2.1+deb11u1, 188K                                                                                                           2.1.28 dfsg-10, 167K
-libsasl2-modules              2.1.27 dfsg-2.1+deb11u1, 268K                                                                                                           2.1.28 dfsg-10, 284K
-libsasl2-modules-db           2.1.27 dfsg-2.1+deb11u1, 101K                                                                                                           2.1.28 dfsg-10, 77K
-libseccomp2                   2.5.1-1 deb11u1, 158K                                                                                                                   2.5.4-1 b3, 149K
-libselinux1                   3.1-3, 207K                                                                                                                             3.4-1 b6, 199K
-libsemanage-common            3.1-1, 36K                                                                                                                              3.4-1, 37K
-libsmartcols1                 2.36.1-8 deb11u1, 328K                                                                                                                  2.38.1-5 b1, 290K
-libsqlite3-0                  3.34.1-3, 1.5M                                                                                                                          3.40.1-2, 1.6M
-libss2                        1.46.2-2, 113K                                                                                                                          1.47.0-2, 70K
-libstdc++6                    10.2.1-6, 2.3M                                                                                                                          12.2.0-14, 2.6M
-libsystemd0                   247.3-7 deb11u2, 865K                                                                                                                   252.6-1, 903K
-libtasn1-6                    4.16.0-2 deb11u1, 124K                                                                                                                  4.19.0-2, 124K
-libtinfo6                     6.2 20201114-2+deb11u1, 537K                                                                                                            6.4-4, 541K
-libtirpc-common               1.3.1-1 deb11u1, 34K                                                                                                                    1.3.3 ds-1, 35K
-libtirpc3                     1.3.1-1 deb11u1, 229K                                                                                                                   1.3.3 ds-1, 226K
-libudev1                      247.3-7 deb11u2, 282K                                                                                                                   252.6-1, 238K
-libunistring2                 0.9.10-4, 1.6M                                                                                                                          1.0-2, 1.8M
-libuuid1                      2.36.1-8 deb11u1, 129K                                                                                                                  2.38.1-5 b1, 80K
-libxxhash0                    0.8.0-2, 114K                                                                                                                           0.8.1-1, 99K
-libzstd1                      1.4.8 dfsg-2.1, 904K                                                                                                                    1.5.4 dfsg2-5, 785K
-login                         1:4.8.1-1, 2.3M                                                                                                                         1:4.13 dfsg1-1+b1, 2.5M
-logsave                       1.46.2-2, 93K                                                                                                                           1.47.0-2, 49K
-mawk                          1.3.4.20200120-2, 242K                                                                                                                  1.3.4.20200120-3.1, 263K
-media-types                   4.0.0, 92K                                                                                                                              10.0.0, 92K
-mount                         2.36.1-8 deb11u1, 438K                                                                                                                  2.38.1-5 b1, 394K
-ncurses-base                  6.2 20201114-2+deb11u1, 386K                                                                                                            6.4-4, 379K
-ncurses-bin                   6.2 20201114-2+deb11u1, 646K                                                                                                            6.4-4, 636K
-netbase                       6.3, 41K                                                                                                                                6.4, 36K
-openssl                       1.1.1n-0 deb11u4, 1.4M                                                                                                                  3.0.9-1, 2.2M
-passwd                        1:4.8.1-1, 2.7M                                                                                                                         1:4.13 dfsg1-1+b1, 2.8M
-perl-base                     5.32.1-4 deb11u2, 7.5M                                                                                                                  5.36.0-7, 7.5M
-pinentry-curses               1.1.0-4, 121K                                                                                                                           1.2.1-1, 140K
-publicsuffix                  20220811.1734-0 deb11u1, 336K                                                                                                           20230209.2326-1, 339K
-python3-minimal               3.9.2-3, 121K                                                                                                                           3.11.2-1 b1, 111K
-readline-common               8.1-1, 92K                                                                                                                              8.2-1.3, 89K
-sed                           4.7-1, 883K                                                                                                                             4.9-1, 987K
-sysvinit-utils                2.96-7 deb11u1, 79K                                                                                                                     3.06-4, 100K
-tar                           1.34 dfsg-1, 3.1M                                                                                                                       1.34 dfsg-1.2, 3.1M
-tzdata                        2021a-1 deb11u10, 3.3M                                                                                                                  2023c-5, 2.5M
-util-linux                    2.36.1-8 deb11u1, 4.5M                                                                                                                  2.38.1-5 b1, 4.9M
-wget                          1.21-1 deb11u1, 3.4M                                                                                                                    1.21.3-1 b2, 3.5M
-zlib1g                        1:1.2.11.dfsg-2 deb11u2, 167K                                                                                                           1:1.2.13.dfsg-1, 168K

I'll look into pinning the distro in the python base image, defaulting to bookworm going forward.

@patroqueeet
Copy link
Author

good morning, I strongly appreciate your precise information. generally speaking, in terms of future upgrades, if either Python or Debian go that way, staying with the old code/env on our side, is not a good idea I'd say. so probably we will have to accept that change and adapt our pdf rendering logic, so tests will pass again. what do you think?

@nikolaik
Copy link
Owner

nikolaik commented Aug 7, 2023

Sorry for not updating you! I'm glad we agreed on a path forward. Did you manage dot solve the issue with the differing fonts and failed rendering of utf-8 characters in your PDFs?

@patroqueeet
Copy link
Author

good morning, as of now we're running with the sha-pinned version:

FROM nikolaik/python-nodejs:python3.10-nodejs16-slim@sha256:83b53ec0f40e5a7815a8d59ad0f06826a0c0d4063ac652293a8fc64ac7bca957 as darg_python

@nikolaik
Copy link
Owner

bookworm has been the default for a while. Hope you have been able to migrate <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants