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

bad request returns invalid gzip compressed data #656

Closed
fengelniederhammer opened this issue Feb 20, 2024 · 1 comment · Fixed by #657
Closed

bad request returns invalid gzip compressed data #656

fengelniederhammer opened this issue Feb 20, 2024 · 1 comment · Fixed by #657
Assignees
Labels
bug Something isn't working LAPIS Tasks/PR related to LAPIS
Milestone

Comments

@fengelniederhammer
Copy link
Contributor

Apparently, when SILO returns a 400 and LAPIS was requested to return compressed data, LAPIS sends out compressed data, but not the corresponding header. Investigate and eventually fix.

@fengelniederhammer fengelniederhammer added bug Something isn't working LAPIS Tasks/PR related to LAPIS labels Feb 20, 2024
@fengelniederhammer fengelniederhammer self-assigned this Feb 20, 2024
@fengelniederhammer fengelniederhammer changed the title bad request - compressed bad request returns invalid gzip compressed data Feb 20, 2024
fengelniederhammer added a commit that referenced this issue Feb 20, 2024
Apparently the following happened:
* The gzip stream eagerly writes the gzip header to the underlying stream (in its constructor)
* an error occurs
* Spring's error handling resets the response buffer (erasing the gzip header)
* The exception handler writes a messages, which gets gzip compressed.

Fix by: Delay initializing the gzip output stream until something is written to it.
@fengelniederhammer
Copy link
Contributor Author

Observations:

  • Zstd works correctly
  • Gzip doesn't
  • When sending a request that returns an error, then the response is not valid gzip data. At least the gzip header (the magic bytes) are missing

fengelniederhammer added a commit that referenced this issue Feb 20, 2024
Apparently the following happened:
* The gzip stream eagerly writes the gzip header to the underlying stream (in its constructor)
* an error occurs
* Spring's error handling resets the response buffer (erasing the gzip header)
* The exception handler writes a messages, which gets gzip compressed.

Fix by: Delay initializing the gzip output stream until something is written to it.
fengelniederhammer added a commit that referenced this issue Feb 20, 2024
Apparently the following happened:
* The gzip stream eagerly writes the gzip header to the underlying stream (in its constructor)
* an error occurs
* Spring's error handling resets the response buffer (erasing the gzip header)
* The exception handler writes a messages, which gets gzip compressed.

Fix by: Delay initializing the gzip output stream until something is written to it.
@fengelniederhammer fengelniederhammer added this to the COVID-LAPIS milestone Feb 21, 2024
fengelniederhammer added a commit that referenced this issue Feb 21, 2024
Apparently the following happened:
* The gzip stream eagerly writes the gzip header to the underlying stream (in its constructor)
* an error occurs
* Spring's error handling resets the response buffer (erasing the gzip header)
* The exception handler writes a messages, which gets gzip compressed.

Fix by: Delay initializing the gzip output stream until something is written to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LAPIS Tasks/PR related to LAPIS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant