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

introduce query rows limit to avoid OOM #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emmanueltouzery
Copy link

@emmanueltouzery emmanueltouzery commented Dec 8, 2023

so I realized that my machine will OOM if I run (by mistake) a very large query with dadbod. Thanks to the linux OOM killer, my machine is only unresponsive for some number of seconds, but then (in the best case) neovim is killed, which is not ideal.
People should not make mistakes, but...

So this change introduces a configurable max number of rows to fetch before aborting a query to avoid such situations.

There is a least one little issue with this patch: if the limit is in fact reached, and rows come in fast, the warning "Query aborted..." can be written multiple times to the output before the writes do in fact stop.

UPDATE: made a followup force push that fixes the writing "query aborted" multiple times and also the case where the file would be truncated in the middle of a line.

@emmanueltouzery emmanueltouzery force-pushed the query_rows_limit branch 4 times, most recently from a4d0866 to 6bc5008 Compare December 10, 2023 17:47
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

Successfully merging this pull request may close these issues.

1 participant