voreen-project / voreen

Voreen - The Volume Rendering Engine
Other
3 stars 2 forks source link

Json gzip compression not working on windows #12

Open sleistikow opened 3 weeks ago

sleistikow commented 3 weeks ago

(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.

ftilde commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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.