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

Json gzip compression not working on windows #12

Open
sleistikow opened this issue Oct 29, 2024 · 3 comments
Open

Json gzip compression not working on windows #12

sleistikow opened this issue Oct 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@sleistikow
Copy link
Contributor

(De-) serializing using the json backend and enabled gzip compression fails on Windows. This even happens when gzip::no_compression is used for the compressing stream.
The bug most likely exists since we introduced the feature, because boost was never updated since then.
It was also never detected since the Serializer-Testsuite just does not use compression.

As a workaround, compression will be disabled on windows and a warning will be emitted until the problem is solved.
This, however, destroys portability across plattforms of files e.g. created by VesselGraphSave.

I would suggest to extend the Serializer-Testsuite to also test pretty printing & compression for all possible permutations.

@sleistikow sleistikow added the bug Something isn't working label Oct 29, 2024
@ftilde
Copy link
Contributor

ftilde commented Oct 29, 2024

This, however, destroys portability across plattforms of files e.g. created by VesselGraphSave.

That's very annoying indeed. Do you have any idea what's the reason for this? Is there an upstream bug report somewhere?

enabled gzip compression fails on Windows

In what way does it fail?

I would suggest to extend the Serializer-Testsuite to also test pretty printing & compression for all possible permutations.

That's definitely a good idea.

@sleistikow
Copy link
Contributor Author

Do you have any idea what's the reason for this? Is there an upstream bug report somewhere?

As of right now I don't really have a clue. It might have something to do with an outdated zlib version (if I'm not confusing zlib, szip and gzip here..). Long time ago, I already had to add a preprocessor definition in the json(de)serializer.cpp files due to a bug in the boost library, maybe that is somewhat related. I also tried to replace gzip by bzip2 but that resulted in tons of linker errors I wasn't willing to address.
When (aka. if) I've time, I'll do more research on that.

In what way does it fail?

The compressed stream seems to be corrupted, it just can't be read by neither the windows nor linux version. The emitted error is Could not parse json: Miss fraction part in number. at 3072 or, if pretty printing is enabled: Could not parse json: The document is empty. at 0 (at least for VesselGraphSource).
What remains to be tested is writing on linux and reading on windows.

As for extending the serialization tests I don't see a "one-line" solution, since we use the same templated test cases for Xml and Json (de)serialization. Do you have any idea on how to extend the test suite without rewriting it?

@sleistikow
Copy link
Contributor Author

A suggestion was to explicitly flush the stream (i.e. adding sb->Flush(); at the very end of void JsonSerializer::write(..)).
This didn't solve the problem, however.

As workaround, we add a non-compressed serialization option to VesselGraph{Save,Source} but disable the compression option on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants