Aleem89 opened a new issue, #45885:
URL: https://github.com/apache/superset/issues/45885
### Bug description
_I ran into this by hand while testing #45802 on our rc2 instance; the
investigation below was done with Claude's help._
On 7.0.0rc2, Download → Export to PDF and Download → Download as image
freeze the page on a dashboard with a large pivot or table, and after one to
two minutes Chrome aborts the tab (`Aw, Snap! Error code: SIGILL`). The same
dashboard exports after 20-30 seconds on 6.1.0.
**Steps to reproduce** (Superset's own example data, nothing else needed)
1. `superset load-examples`.
2. Pivot Table chart on `birth_names`: rows = `name`, columns = `ds` (time
grain Year), metric SUM(`num`), row limit 10000. About 11,000 cells.
3. Table chart on `birth_names`: group by `name`, six metrics (SUM num, SUM
num_boys, SUM num_girls, MAX num, MIN num, SUM num_california), row limit 1000,
server pagination off.
4. Put both on a dashboard. Open it in Chrome, Download → Export to PDF.
Reload, then Download → Download as image.
**Expected:** a file downloaded with a wait depending on the size of the
tables on dashboard, as on 6.1.0.
**Actual:** the page freezes, renderer memory climbs by roughly 100 MB/s,
and Chrome kills the tab. Same on Chrome 141 and 156, Ubuntu, 14 GB RAM. A
colleague's Mac with the same RAM finishes after a long wait. Firefox 158 does
not crash but each export takes close to a minute.
**Cause**
A DevTools profile of the freeze shows nearly all the time in the capture
library copying computed styles onto the cloned page (`setProperty` /
`getPropertyValue`), not in drawing. What changed since 6.1 is how much style
each element carries: with antd 6's CSS-variable theming, every element
inherits ~440 `--ant-*` variables, and both capture libraries copy them onto
every cloned element. Same dashboard, same machine:
| | 6.1.0 | 7.0.0rc2 |
|---|---|---|
| Computed CSS properties per table cell | 480 | 920 (440 are `--ant-*`) |
| Peak renderer memory, Export to PDF | 1.2 GB | 6.8 GB |
| Peak renderer memory, Download as image | 1.0 GB | 6.0 GB |
The PDF path uses `dom-to-pdf` 0.3.2, which bundles an unmaintained 2019
fork of `dom-to-image` 2.6.0 and copies the full computed style of every node;
it is identical in 6.1.0 and 7.0.0rc2. The image path uses `dom-to-image-more`
3.11, which skips default-valued properties, but the variables are never
default, so it copies them too.
**A fix I tried locally**
Skip custom properties (`--*`) when copying styles. They are inherited from
the root and every real property is copied as its resolved value, so they add
nothing to the picture.
- Download as image: `dom-to-image-more`'s `filterStyles` option with `name
=> !name.startsWith('--')`. One line plus a shared helper.
- Export to PDF: `dom-to-pdf` has no such option, so I replaced it with a
small in-repo module doing the same job (hidden clone, page-break spacers, A4
slicing) on top of `dom-to-image-more` + `jsPDF`, both already in the tree. One
dependency removed, none added.
| `birth_names` dashboard above, Chrome 156 | before | after |
|---|---|---|
| Export to PDF | 8.5 GB, tab killed | 0.9 GB, ~25 s, PDF visually identical
|
| Download as image | 8.3 GB, tab killed | 1.2 GB, image byte-identical |
**Two asks**
1. Does replacing `dom-to-pdf` sound like the right direction, or would you
prefer another approach? Happy to open it as potentially two PRs, the one-line
image change and the PDF replacement separately.
2. Could someone try the steps above in Chrome on their own machine and say
whether it crashes or finishes, and how long it takes? So far: Linux crashes, a
Mac with the same RAM finishes slowly. Windows result to follow.
Semi-related: #45802 (blank/overlapping charts in the same export on 6.x).
Its fixes (#42561, #44414) are working in rc2 and do not appear to be the cause
here.
### Screenshots/recordings
Screen recording of the PDF export crashing the tab (Chrome 156, Linux, real
dashboard, data blurred; the wait is sped up 12x).
https://github.com/user-attachments/assets/1e848d64-4bd4-4613-885d-a2b73618beb1
### Superset version
master / latest-dev
### Python version
3.11
### Node version
Not applicable
### Browser
Chrome
### Additional context
- Chrome 141 and 156 on Ubuntu 22.04, 14 GB RAM: tab aborts with SIGILL on
both exports. Chrome on a colleague's Mac with the same RAM finishes after a
long wait. Firefox 158: no crash, but close to a minute per export.
- Reproduced on the official `apache/superset:7.0.0rc2` image with no custom
config or CSS (the `birth_names` steps above) and on our own rc2 instance. The
same dashboards export in a few seconds on 6.1.0.
- A smaller dashboard (about 7,950 cells) still crashes the PDF export but
survives the image export, so the threshold is memory, not a row count.
### Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [ ] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]