Skip to content

added error when executable crashes #30341

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

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

Conversation

lynnmunday
Copy link
Contributor

closes #30340

@moosebuild
Copy link
Contributor

moosebuild commented Apr 16, 2025

Job Documentation, step Docs: sync website on e3eaf0b wanted to post the following:

View the site here

This comment will be updated on new commits.

@moosebuild
Copy link
Contributor

moosebuild commented Apr 16, 2025

Job Coverage, step Generate coverage on e3eaf0b wanted to post the following:

Framework coverage

41d1ea #30341 e3eaf0
Total Total +/- New
Rate 85.43% 85.43% -0.00% -
Hits 112330 112329 -1 0
Misses 19156 19157 +1 0

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

Comment on lines 531 to 536
try:
output = runCommand("%s --show-capabilities" % exe)
except:
print("Error! Executable crashed.")
exit(1)

Copy link
Member

Choose a reason for hiding this comment

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

You could put this try/catch into runCommand...

Copy link
Contributor Author

@lynnmunday lynnmunday Apr 16, 2025

Choose a reason for hiding this comment

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

I didn't know how to put a try catch on subprocess.Popen, I don't think it fails.

def runCommand(cmd, cwd=None):
    # On Windows it is not allowed to close fds while redirecting output
    should_close = platform.system() != "Windows"
    p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=should_close, shell=True)
    output = p.communicate()[0].decode('utf-8')
    if (p.returncode != 0):
        output = 'ERROR: ' + output
    return output

Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming what fails is the communicate(). Something must be throwing the exception in there, otherwise there'd be nothing to catch in getCapabilities...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wrong, I wasn't catching the exception. I pasted in the error messages below. I added some extra output to the exception that has always been raised.

@lynnmunday
Copy link
Contributor Author

This is was the old error message I got when the executable segfaults with --show-capabilities

(moose) INL621590:porous_flow mundlb$ rt
Traceback (most recent call last):
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 716, in parseMOOSEJSON
    output = output.split('**START JSON DATA**\n')[1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mundlb/projects/moose/modules/porous_flow/./run_tests", line 8, in <module>
    TestHarness.buildAndRun(sys.argv, None, MOOSE_DIR)
  File "/Users/mundlb/projects/moose/python/TestHarness/TestHarness.py", line 231, in buildAndRun
    harness = TestHarness(argv, moose_dir, moose_python_dir, test_root)
  File "/Users/mundlb/projects/moose/python/TestHarness/TestHarness.py", line 311, in __init__
    self.options._capabilities = util.getCapabilities(self.executable)
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 532, in getCapabilities
    return parseMOOSEJSON(output, '--show-capabilities')
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 724, in parseMOOSEJSON
    raise Exception(output_string)
Exception:  Failed to find JSON header and footer from --show-capabilities

With this change it will show any errors the executable might have produced and the exception:

(moose) INL621590:porous_flow mundlb$ rt
Traceback (most recent call last):
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 716, in parseMOOSEJSON
    output = output.split('**START JSON DATA**\n')[1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mundlb/projects/moose/modules/porous_flow/./run_tests", line 8, in <module>
    TestHarness.buildAndRun(sys.argv, None, MOOSE_DIR)
  File "/Users/mundlb/projects/moose/python/TestHarness/TestHarness.py", line 231, in buildAndRun
    harness = TestHarness(argv, moose_dir, moose_python_dir, test_root)
  File "/Users/mundlb/projects/moose/python/TestHarness/TestHarness.py", line 311, in __init__
    self.options._capabilities = util.getCapabilities(self.executable)
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 532, in getCapabilities
    return parseMOOSEJSON(output, '--show-capabilities')
  File "/Users/mundlb/projects/moose/python/TestHarness/util.py", line 724, in parseMOOSEJSON
    raise Exception(output_string)
Exception:
ERROR: dyld[67113]: symbol not found in flat namespace '__ZN39PorousFlowPermeabilityKozenyCarmanTemplILb0EE19computeQpPropertiesEv'
Failed to find JSON header and footer from --show-capabilities

I think this would have helped me find my error.

@lynnmunday lynnmunday force-pushed the capabilities_tester_error branch from 7ad2b12 to 61de797 Compare April 18, 2025 20:10
@moosebuild
Copy link
Contributor

Job Python 3.11 on 61de797 : invalidated by @lynnmunday

@moosebuild
Copy link
Contributor

Job Modules parallel on 61de797 : invalidated by @lynnmunday

navierstokes distributed failed

@moosebuild
Copy link
Contributor

Job Coverage, step Verify coverage on 61de797 wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate chemical_reactions coverage rate (required: 92.0%)
  • Failed to generate contact coverage rate (required: 87.0%)
  • Failed to generate electromagnetics coverage rate (required: 94.0%)
  • Failed to generate external_petsc_solver coverage rate (required: 84.0%)
  • Failed to generate fluid_properties coverage rate (required: 84.0%)
  • Failed to generate fsi coverage rate (required: 85.0%)
  • Failed to generate functional_expansion_tools coverage rate (required: 81.0%)
  • Failed to generate geochemistry coverage rate (required: 96.0%)
  • Failed to generate heat_transfer coverage rate (required: 87.0%)
  • Failed to generate level_set coverage rate (required: 85.0%)
  • Failed to generate misc coverage rate (required: 32.0%)
  • Failed to generate navier_stokes coverage rate (required: 77.0%)
  • Failed to generate optimization coverage rate (required: 86.0%)
  • Failed to generate peridynamics coverage rate (required: 77.0%)
  • Failed to generate phase_field coverage rate (required: 85.0%)
  • Failed to generate porous_flow coverage rate (required: 95.0%)
  • Failed to generate ray_tracing coverage rate (required: 93.0%)
  • Failed to generate rdg coverage rate (required: 63.0%)
  • Failed to generate reactor coverage rate (required: 90.0%)
  • Failed to generate scalar_transport coverage rate (required: 81.0%)
  • Failed to generate solid_mechanics coverage rate (required: 84.0%)
  • Failed to generate solid_properties coverage rate (required: 83.0%)
  • Failed to generate stochastic_tools coverage rate (required: 88.0%)
  • Failed to generate subchannel coverage rate (required: 87.0%)
  • Failed to generate thermal_hydraulics coverage rate (required: 88.0%)
  • Failed to generate xfem coverage rate (required: 80.0%)

1 similar comment
@moosebuild
Copy link
Contributor

Job Coverage, step Verify coverage on 61de797 wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate chemical_reactions coverage rate (required: 92.0%)
  • Failed to generate contact coverage rate (required: 87.0%)
  • Failed to generate electromagnetics coverage rate (required: 94.0%)
  • Failed to generate external_petsc_solver coverage rate (required: 84.0%)
  • Failed to generate fluid_properties coverage rate (required: 84.0%)
  • Failed to generate fsi coverage rate (required: 85.0%)
  • Failed to generate functional_expansion_tools coverage rate (required: 81.0%)
  • Failed to generate geochemistry coverage rate (required: 96.0%)
  • Failed to generate heat_transfer coverage rate (required: 87.0%)
  • Failed to generate level_set coverage rate (required: 85.0%)
  • Failed to generate misc coverage rate (required: 32.0%)
  • Failed to generate navier_stokes coverage rate (required: 77.0%)
  • Failed to generate optimization coverage rate (required: 86.0%)
  • Failed to generate peridynamics coverage rate (required: 77.0%)
  • Failed to generate phase_field coverage rate (required: 85.0%)
  • Failed to generate porous_flow coverage rate (required: 95.0%)
  • Failed to generate ray_tracing coverage rate (required: 93.0%)
  • Failed to generate rdg coverage rate (required: 63.0%)
  • Failed to generate reactor coverage rate (required: 90.0%)
  • Failed to generate scalar_transport coverage rate (required: 81.0%)
  • Failed to generate solid_mechanics coverage rate (required: 84.0%)
  • Failed to generate solid_properties coverage rate (required: 83.0%)
  • Failed to generate stochastic_tools coverage rate (required: 88.0%)
  • Failed to generate subchannel coverage rate (required: 87.0%)
  • Failed to generate thermal_hydraulics coverage rate (required: 88.0%)
  • Failed to generate xfem coverage rate (required: 80.0%)

@lynnmunday
Copy link
Contributor Author

@dschwen Will you review and merge?

@lynnmunday
Copy link
Contributor Author

The latest commit will only show:

(moose) INL621590:poroperm mundlb$ rt
Error! Executable crashed running --show-capbilities.

@lynnmunday lynnmunday force-pushed the capabilities_tester_error branch from 61de797 to e3eaf0b Compare April 22, 2025 17:58
Comment on lines +532 to +534
if output.startswith("ERROR"):
print("Error! Executable crashed running --show-capbilities.")
exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

No, that's not right. You might get a crash without the ERROR string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is right, you get an ERROR whenever the executable crashes.

line 226 appends ERROR when the executable crashes.

    p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=should_close, shell=True)
    output = p.communicate()[0].decode('utf-8')
    if (p.returncode != 0):
        output = 'ERROR: ' + output

I can't change the code in the runCommand function because its called by the testHarness and shouldn't exit if it segfaults, it should return an ERROR.

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.

add error for executable failure in tester
3 participants