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

Return early from LineReaderImpl.doList if no possibilities or rows (fixes #941) #942

Merged
merged 4 commits into from
Apr 17, 2024

Conversation

VerKWer
Copy link
Contributor

@VerKWer VerKWer commented Feb 29, 2024

Calling LineReaderImpl.redisplay when running in a container started via compose can trigger infinite recursion, eventually throwing a StackOverflowError.

@VerKWer VerKWer changed the title Fix Issue #941 Return early from LineReaderImpl.doList if no possibilities or rows (fixes #941) Feb 29, 2024
@VerKWer
Copy link
Contributor Author

VerKWer commented Feb 29, 2024

This is my attempt at fixing issue #941. Unfortunately, I don't have very deep knowledge about the workings of JLine and it might be completely wrong what I'm doing here. It does seem to fix the issue in my projects and it makes sense to me that if there are no possibilities to list (or no space to list them), we should bail out early. Still, any additional input is greatly appreciated.

When running inside a detached Docker container, calling LineReaderImpl.redisplay
resulted in a StackOverflowError. The reason for this is that redisplay eventually
calls doList, which again calls redisplay because the size.getRows() is 0.
@gnodet
Copy link
Member

gnodet commented Mar 1, 2024

Thx, I think there are two more size.getRows() calls at line 5050 and 5060 in the same method.

@VerKWer
Copy link
Contributor Author

VerKWer commented Mar 1, 2024

Indeed, I saw those but wasn't sure about replacing them because they are inside a lambda, which I believe only executes later. I'm not sure about the details here but since the terminal size can change, I figured it makes more sense to re-read it when post actually runs?

@gnodet gnodet added this to the 3.26.0 milestone Mar 8, 2024
@gnodet gnodet merged commit 643b859 into jline:master Apr 17, 2024
4 checks passed
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.

None yet

2 participants