qorelanguage / qore

Qore Programming Language
GNU General Public License v2.0
60 stars 10 forks source link

module-process: race condition in returning the process exit status #4272

Open davidnich opened 3 years ago

davidnich commented 3 years ago

sometimes a process's exit status is returned incorrectly as -1 instead of 0

ex - successful execution of a test with the process module:

"
  stderr : "Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF8
"
  exit_code : -1

The actual exit code was 0

also there can be false negatives:

resp: hash: (5 members)
  status : "FINISHED"
  exit_code : 0
  stderr : "User exception: /opt/qorus/qlib/QorusObjectParser/QorusObjectParser.ql:48 (Qore): INVALID-NAME: invalid characters in name \"test_servi/ce\"; allowed name format: [A-Za-z0-9-_]*
  validate_object_name() called at /opt/qorus/qlib/QorusObjectParser:324 (Qore user code)
  TagParser::gotEnd() called at /opt/qorus/qlib/QorusObjectParser:231 (Qore user code)
  TagParser::parse() called at /opt/qorus/qlib/QorusObjectParser/QorusObjectParserAPI.qc:112 (Qore user code)
  Parser::parse() called at /opt/qorus/bin/oload:2055 (Qore user code)
  oload::createServices() called at /opt/qorus/bin/oload:861 (Qore user code)
  oload::constructor() called at <builtin>:-1 (Qore user code)

"
  stdout : "\"/opt/qorus/user/tmp/qorusBug2541N5aoXhfmpXjKxV5/service_2541.qsd\": "
  created : 2021-07-02 07:07:22.000000 Fri +02:00 (CEST)
davidnich commented 3 years ago

still happening occasionally... root cause unknown

davidnich commented 2 years ago

likely to be a race condition in the boost process library handling SIGCHLD

davidnich commented 2 years ago

hopefully finally fixed:

davidnich commented 2 years ago

this is still happening - rarely. but it still happens

"
  stderr : "Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF8
"
  exit_code : -1
FAILURE: mainTest: 3 assertions, 2 succeeded
Assertion failure at /builds/qorus/qorus/test/QorusBug3233ConfigItems.qtest:59 [Main::mainTest()] <- /builds/qorus/qorus/test/QorusBug3233ConfigItems.qtest:37 [Main::constructor()]
-----
    >> Expected: 0, Actual: -1, Difference: 1
-----
Ran 1 test case, 1 error (3 assertions, 2 succeeded)
+ RESULTS=' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1'