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

Query result parsing fails, but /items still return empty HTTP 200 result #88

Open
komima opened this issue Jan 9, 2024 · 2 comments
Open
Milestone

Comments

@komima
Copy link

komima commented Jan 9, 2024

image

When the data types change on the DB side without restarting the hakunapi service, for example a datetime->date change on a column will trigger above error in resultset parsing, but this is not indicated by HTTP 5xx status code.

@jampukka
Copy link
Collaborator

jampukka commented Jan 10, 2024

This is due to the current streaming implementation. I think we could change the logic so that we first buffer a set of features before commiting to writing 200 OK (e.g. change BufferedResultSet to eagerly fetch the first batch of features, not lazily during first call to hasNext() so that we fail before any bytes are written to the OutputStream provided to us by the JAX-RS impl). That might do the trick depending on how the JAX-RS implementation acts. Otherwise it's bit larger change to the logic: we'd have to buffer the serialization phase by trying to write first n bytes to memory before returning Response.ok() to the JAX-RS implementation. Still doable though.

@jampukka
Copy link
Collaborator

The error might occur when writing nth feature so it's difficult to determine the right amount of buffering. One megabyte might solve most problems but not all.

Also the highlighted issue might not be something hakunapi even aims to support (handling changes in sources after startup). Obviously it might be difficult to recognize these sorts of errors if service monitoring is configured to just check the status code. Not sure what would be correct move here.

@nls-jajuko nls-jajuko added this to the 1.5.0 milestone May 23, 2024
@nls-jajuko nls-jajuko modified the milestones: 1.5.0, 1.6.0 Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants