-
Notifications
You must be signed in to change notification settings - Fork 21
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
Error handling using GraphvizSync() layout #125
Comments
Started failing when the c++ error tweaked its error handling (7.x?). Fixes hpcc-systems#125 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
Started failing when the c++ error tweaked its error handling (7.x?). Fixes hpcc-systems#125 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
Started failing when the c++ error tweaked its error handling (7.x?). Fixes hpcc-systems#125 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
@magjac - thanks, FWIW this was caused by a change in the latest c++ layer, where syntax error exceptions are no longer caught within the c++ code (and I had fixed it in the async variant). |
Started failing when the c++ error tweaked its error handling (7.x?). Fixes hpcc-systems#125 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
Started failing when the c++ error tweaked its error handling (7.x?). Fixes hpcc-systems#125 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
fix: Error handling using GraphvizSync() layout
Excellent! Thanks for the rapid fix. A new release would be immensely appreciated. |
@magjac that release is out now, with added Zstd compression wasm and base91 wasm... |
Thank you so much. I however get a lot of failures in my tests with that version:
I haven't had time to look into them yet so it might still be something I'm doing wrong, but I thought I might let you know directly if you recognize something. It seems that it is only the tests that have problem. The build seems to work fine. Full log: |
Is your test/@hpcc-js/wasm/dist/wrapper.js used in a NodeJS environment? If so it should be wrapping |
dist/index.js -> browser UMD I think your errors are from NodeJS loading a browser bundle... |
Some feedback:
I will start with a fresh brain another day. Any tips are welcome. It seems that something radical changed in version 1.19.0, but it may very well be my usage that has been wrong the whole time. |
Sounds like I sent you down the wrong path - I thought the wrapper code was a helper for your NodeJS based unit tests and not for web workers in general... Let me sanity check with one of my other projects that uses web workers. |
All of this is in NodeJS based tests. It works fine in the browser. |
@magjac - The issue is my end (missing "globalThis") fix is incoming. Also I added a simple webworker unit test, so will catch these in the future. |
@magjac - fix in 1.19.1 - thanks for spotting this! |
Still no luck. I haven't had time to look into the details, but: dist/index.js -> wasm error as per above Which one am I supposed to use inside the tiny-worker in NodeJS test? In version 1.18.0 dist/index.js worked fine. Is it no longer supposed to work for my case? |
I added a NodeJS worker unit test (without any helper modules like tiny-worker) and its working fine. dist/index.js isn't expected to work with ESM NodeJS, but with the new the "external" section in the package.json your environment is supposed to auto pick the correct variant. FWIW You can see the diffs in the vanilla Browser and NodeJS workers (Base91 is another wasm file in @hpcc-js/wasm): NodeJS:
Browser:
|
@magjac - you may want to hold off on this as I have a new build pipeline working (which has been in the works for a while):
What you end up with is a single JS file including the wasm which will be NodeJS and Browser compatible and no need to worry about things like wasmFolder! ...and... For GraphViz the entire JS file clocks in at 600k compared with the wasm file which is 1046k on its own. |
I don't know where this comment went, but the answer is that it doesn't. I only use NodeJS for test. |
IMO You might want to run your tests in a web browser and use something like karma to orchestrate those tests in a headless environment (like GitHub actions) - you are doing a "lot" of work in your test folder to fake a web environment in NodeJS by the looks of it? I have updated my very simple index.html file to include samples of:
Online demo: https://raw.githack.com/hpcc-systems/hpcc-js-wasm/trunk/index.html For web workers, this is the html: <script type="module">
const div = document.getElementById("placeholder5");
const myWorker = new Worker("./index-worker.js", { type: 'module' });
myWorker.onmessage = (e) => {
div.innerHTML = e.data;
}
myWorker.postMessage(dot);
</script> And import { Graphviz } from "https://cdn.jsdelivr.net/npm/@hpcc-js/wasm/dist/sfx-graphviz.esm.js";
onmessage = async e => {
const graphviz = await Graphviz.load();
const svg = graphviz.layout(e.data, "svg", "dot");
postMessage(svg);
} Which is pretty clean. You can swap out the URL for "@hpcc-js/wasm/dist/sfx-graphviz.esm" or similar and bundle it with rollup to make it self contained... |
@magjac - Just published v2.0.0 which is now ESM by default and comes with a simplified load and use pattern (and new docs): https://hpcc-systems.github.io/hpcc-js-wasm/classes/graphviz.Graphviz.html |
Sorry for the delay. Thanks a lot for your efforts. It seems I have a lot of investigation/rework to do. Unfortunately I have almost no time for this in the very near future. Would it be possible for you to make a patch release on v1.18.0 with only a fix for this issue? This way I could make a new release of d3-graphviz and deal with these somewhat larger issues later on. |
|
@magjac Hopefully v1.16.6 should work... |
Thanks. Unfortunately #120 bit me. I forgot that this caused issues in after having adopted type=module. Perhaps a patch on v1.18.0 is the only short-term solution for me after all. I'm so sorry for the confusion. |
For the record: @GordonSmith fixed my problem in magjac/d3-graphviz#254. Many many thanks, Gordon ❤️ |
I'm not at all sure that this is a bug in hpcc-js/wasm, but I have indications that the error handling when using GraphvizSync() does not work. I'm getting an error saying "full function or function signature mismatch" instead of the expected "syntax error in line 1 near 'bad'".
I haven't yet had time to boil this down to a minimal test case, so for now this is mainly a question if you have tested this. Error handling using the asynchronous Graphviz() seems to work as expected.
More details can be found at https://github.com/magjac/d3-graphviz/actions/runs/3372738896/jobs/5596518645
If this seems to work for you I will try to carve out some time to create a minimal test case.
The text was updated successfully, but these errors were encountered: