terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
18.16k stars 447 forks source link

d2 freezes immediately when rendering diagram, after upgrade to v0.6.7 #2140

Open mradamcox opened 1 month ago

mradamcox commented 1 month ago

I just upgraded from v0.6.1 to v0.6.7, and now when I try to render a diagram the process just freezes.

echo "a -> b" > test.d2
d2 test.d2 test.png -d

This prints

debug: using theme Neutral default (ID: 0)

and then just stops. When I ctrl-C to cancel, nothing happens and I eventually just have to close the console.

I reinstalled the older version with

curl -fsSL https://d2lang.com/install.sh | sh -s -- --version v0.6.1

and it now works properly.


I'm on PopOS 22 (Ubuntu) and here's the output from the install

curl -fsSL https://d2lang.com/install.sh | sh -s --
/* installing d2-latest */
log: fetching info on latest version of terrastruct/d2
exec: curl -fL -#o /tmp/tmp.5WPrDLP9B8/78d207313efc3717/release-info.json.inprogress -C- -H 'Accept: application/json' https://api.github.com/repos/terrastruct/d2/releases/latest
##O=#  #                                                                      
exec: mv /tmp/tmp.5WPrDLP9B8/78d207313efc3717/release-info.json.inprogress /tmp/tmp.5WPrDLP9B8/78d207313efc3717/release-info.json
log: installing standalone release d2-v0.6.7-linux-amd64.tar.gz from github
exec: cat "$RELEASE_INFO" | grep -n "$ARCHIVE" | cut -d: -f1 | head -n1
exec: sed -n $((asset_line-3))p "$RELEASE_INFO" | sed "s/^.*: \"\(.*\)\",$/\1/g"
exec: curl -fL -#o ~/.cache/d2/release/d2-v0.6.7-linux-amd64.tar.gz.inprogress -C- -H 'Accept: application/octet-stream' https://api.github.com/repos/terrastruct/d2/releases/assets/195593650
######################################################################## 100.0%
exec: mv ~/.cache/d2/release/d2-v0.6.7-linux-amd64.tar.gz.inprogress ~/.cache/d2/release/d2-v0.6.7-linux-amd64.tar.gz
exec: mkdir -p '$HOME/.local/lib/d2'
exec: tar -C ~/.local/lib/d2 -xzf ~/.cache/d2/release/d2-v0.6.7-linux-amd64.tar.gz
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'
exec: sh -c 'cd "$HOME/.local/lib/d2/d2-v0.6.7" && make install PREFIX="$HOME/.local"'
exec: mkdir -p ~/.local/bin
exec: install ./bin/d2 ~/.local/bin/d2
exec: mkdir -p ~/.local/share/man/man1
exec: install ./man/d2.1 ~/.local/share/man/man1
/****************************************************************
 * next steps
 ****************************************************************/
log: d2-v0.6.7-linux-amd64 has been successfully installed into ~/.local
log: Rerun this install script with --uninstall to uninstall.
log
log: Run d2 --help for usage.
log: Run man d2 for detailed docs.
alixander commented 1 month ago
echo "a -> b" test.d2
d2 test.d2 test.png -d

Is this a copy paste of what you ran? If so, test.d2 doesn't exist (you missed the |) and it should exit saying no such file. But you said 0.6.1 works with that? I'm confused, can you try some versions in between?

mradamcox commented 1 month ago

Oops, that's my bad, I will correct it above, I typed it in and forgot the >. I will try different versions when I'm back at my laptop. Thanks for the quick reply!

mradamcox commented 1 month ago

Ok, I'm on better internet now, and apparently that has something to do with what I was experiencing... First, I installed all versions between v0.6.1 and v0.6.7. All up to v0.6.7 do render the d2 graph as expected, but one note is that at v0.6.6 I saw the same tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance warnings as shown above, but never in earlier versions.

As for v0.6.7, what I was experiencing as a freeze before, now seems to be initialization of a Chromium download:

$ d2 test.d2 test.png -d
debug: using theme Neutral default (ID: 0)
BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ubuntu22.04-x64.
Downloading Chromium 129.0.6668.29 (playwright build v1134) from https://playwright.azureedge.net/builds/chromium/1134/chromium-linux.zip
164 MiB [====                ] 20% 6.2s
etc.

I was able to cancel this download with ctrl+C without any issue this time around.

I don't see anything about a new dependency like this in the release notes but maybe I just need to have Chromium for d2 to work now? Just looking for clarification on that then.

For my needs I'll be 100% fine with just using v0.6.6, but I am happy to try other tests if that would help you.

alixander commented 1 month ago

Ah I see. Yeah Playwright is needed for PNG exports unfortunately (https://d2lang.com/tour/exports/#png). It's the only possible way to convert SVGs to PNGs. I'm not sure why it's different on different versions, as that shouldn't have changed...

I'll leave this open in case anyone else runs into the same. I really appreciate you trying each version and the detailed report

mradamcox commented 1 month ago

Sounds good, thanks for the explanation.