-
Notifications
You must be signed in to change notification settings - Fork 163
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
Possible infinite recursion in PRINT_OR_APPEND_TO_FILE_OR_STREAM #3028
Comments
See #2487 |
Yes, much of the discussion there is relevant here as well, although the exact issue here I think is not providing an appropriate fallback when we're trying to print error messages from within the error handler, and we can't open the specified stream. |
I believe we resolved this some time ago (and the fixes are already in GAP 4.11). If you still can trigger an issue and/or believe there is one based on reading the code, please don't hesitate to reopen this and/or file a new issue. |
I can believe it's been fixed but I'm not sure since the code I originally implicated hasn't been updated, but it might be dealt with elsewhere. I admit I don't recall how the issue was originally triggered. It might have shown up while developing the workaround I had to add for the Python libgap interface to capture error output: https://gitlab.com/sagemath/sage/-/blob/1e728ac0d36514f52871268588d38fe1392a5e5a/src/sage/libs/gap/util.pyx#L198 |
There is a new dedicated function for opening errout in Line 58 in 9723019
|
I see, that definitely helps! 👍 |
If a stream that is being used to print errors cannot be opened (e.g. an error elsewhere prevents streams from being closed properly) this can result in an infinite recursion when reporting that error.
The specific problem is in the error handling logic here:
gap/src/streams.c
Line 799 in efd3626
If an
ErrorQuit
(for example) occurs elsewhere, and the stream assigned toERROR_OUTPUT
cannot be opened for whatever reason, this results in another call toErrorQuit
with the same broken stream assigned and so on. Perhaps this should do something else: Try to open*errout*
as a last resort,Panic()
, etc.The text was updated successfully, but these errors were encountered: