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

Print full PSIO error message to cerr as well #2997

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

TiborGY
Copy link
Contributor

@TiborGY TiborGY commented Jul 2, 2023

Description

For some poorly understood confluence of reasons, for some users error messages can sometimes get completely lost when Psi4 exits with a PSIEXCEPTION, especially when a PSIO error happens.
This can be observed in recent bug reports, see:

In both of these cases the users were only seeing the error message that has been written to cerr, but not the string that PSIEXCEPTION should have printed.

IIRC when I tried to research this quite a while ago, I have found this may be a bug in some versions of libstdc++. This PR adds a simple workaround: the exception message is also printed to cerr in psio_error.

The only side effect, is that some users, who are currently not affected by the lost message problem, may start getting the same error message twice when a PSIO error happens. Spammy error exits are not great, but PSIO errors are not supposed to happen too often, and when they do loosing the error message is more annoying than having it be duplicated.

User API & Changelog headlines

  • PSIO error messages are now also printed to cerr, fixing an issue where (under some circumstances) large parts of the error message would never reach the user,

Dev notes & details

  • The same error message that gets passed to PSIEXCEPTION is now printed to cerr before throwing in psio_error

Checklist

  • There is no easy way to add tests for "are error messages getting delivered or not?"
  • Tests run by the CI are passing

Status

  • Ready for review
  • Ready for merge

@TiborGY TiborGY changed the title Print full error message to cerr as well, before throwing Print full PSIO error message to cerr as well Jul 2, 2023
@TiborGY TiborGY marked this pull request as ready for review July 2, 2023 18:54
Copy link
Member

@loriab loriab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree better two error messages than zero. Thanks for the fix.

Hopefully #1657 #2999 will fix the CI.

EDIT: fixed PR number

@loriab
Copy link
Member

loriab commented Jul 3, 2023

I'm going to update the branch and then add to merge queue, so heads-up that local != remote.

@loriab loriab enabled auto-merge July 3, 2023 15:46
@loriab loriab added this to the Psi4 1.9 milestone Jul 3, 2023
@loriab loriab added this pull request to the merge queue Jul 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 3, 2023
@JonathonMisiewicz JonathonMisiewicz added this pull request to the merge queue Jul 5, 2023
Merged via the queue into psi4:master with commit 3ec8ae7 Jul 5, 2023
5 checks passed
@TiborGY TiborGY deleted the robust_psio_err_reason branch July 6, 2023 13:40
@susilehtola susilehtola mentioned this pull request Jan 4, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants