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

<pure_gain>: no error messages #497

Open
1 of 3 tasks
ghost opened this issue Aug 27, 2021 · 12 comments
Open
1 of 3 tasks

<pure_gain>: no error messages #497

ghost opened this issue Aug 27, 2021 · 12 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 27, 2021

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

Describe the issue
I noticed that <pure_gain> does not report any errors in its configuration.

What is the current behavior?

  1. Without <input> crashes FlightGear (see below the backtrace).

  2. Without <gain> it silently assumes the gain of 1.

  3. With two <input>s or <gain>s it silently uses the first ones.

What is the expected behavior?
The expected behaviour would be that in case "1." it would print an error and stop FlightGear, and in the other 2 cases print a warning, with enough information to find the misconfigured <gain>.

What is the motivation / use case for changing the behavior?
The warnings would reduce the rate of silent errors occuring in FlgihtGear aircraft.

Please tell us about your environment:
FlightGear next as of 2021-08-26.

Other information
Backtrace for case "1.".

Thread 1 "fgfs" received signal SIGSEGV, Segmentation fault.

<...>

#0  0x000055555623d9c5 in JSBSim::FGGain::Run() ()
#1  0x00005555561f12a9 in JSBSim::FGFCS::Run(bool) ()
#2  0x000055555628f386 in JSBSim::FGFDMExec::Run() ()
#3  0x000055555628f556 in JSBSim::FGFDMExec::RunIC() ()
#4  0x00005555561a4018 in FGJSBsim::init() ()
#5  0x0000555555f42c00 in FDMShell::doInitAndBind() ()
#6  0x0000555555f4381a in FDMShell::update(double) ()
#7  0x00005555564f784a in SGSubsystemGroup::Member::update(double) ()
#8  0x00005555564fc107 in SGSubsystemGroup::update(double) ()
#9  0x00005555564f2eba in SGSubsystemMgr::update(double) ()
#10 0x000055555613f512 in fgMainLoop() ()
#11 0x00005555560926b2 in fgOSMainLoop() ()
#12 0x0000555556144377 in fgMainInit(int, char**) ()
#13 0x00005555558ea7fe in main ()
#0  0x000055555623d9c5 in JSBSim::FGGain::Run() ()
#1  0x00005555561f12a9 in JSBSim::FGFCS::Run(bool) ()
#2  0x000055555628f386 in JSBSim::FGFDMExec::Run() ()
#3  0x000055555628f556 in JSBSim::FGFDMExec::RunIC() ()
#4  0x00005555561a4018 in FGJSBsim::init() ()
#5  0x0000555555f42c00 in FDMShell::doInitAndBind() ()
#6  0x0000555555f4381a in FDMShell::update(double) ()
#7  0x00005555564f784a in SGSubsystemGroup::Member::update(double) ()
#8  0x00005555564fc107 in SGSubsystemGroup::update(double) ()
#9  0x00005555564f2eba in SGSubsystemMgr::update(double) ()
#10 0x000055555613f512 in fgMainLoop() ()
#11 0x00005555560926b2 in fgOSMainLoop() ()
#12 0x0000555556144377 in fgMainInit(int, char**) ()
#13 0x00005555558ea7fe in main ()
@bcoconni bcoconni added the bug label Sep 17, 2021
@bcoconni
Copy link
Member

@Mike402 thanks for the detailed bug report.
I'll investigate.

@bcoconni
Copy link
Member

Regarding the topic 1/, actually the issue is not limited to <pure_gain>. The following FCS components are also suffering from the same issue:

  • <actuator>
  • <deadband>
  • <lag_filter>
  • <lead_lag_filter>
  • <washout_filter>
  • <second_order_filter>
  • <scheduled_gain>
  • <aerosurface_scale>
  • <kinematic>
  • <linear_actuator>
  • <pid>
  • <sensor>

Regarding the topic 2/, that's weird since there is already some code to display a warning if <gain> is not provided under <pure_gain>:

if (Type == "PURE_GAIN") {
if ( !element->FindElement("gain") ) {
cerr << element->ReadFrom()
<< highint << " No GAIN specified (default: 1.0)" << normint
<< endl;
}
}

Could you please check again to see if you did not miss the message "No GAIN specified (default: 1.0)" in the console ?

sthagen added a commit to sthagen/JSBSim-Team-jsbsim that referenced this issue Sep 19, 2021
Check the number of <input> nodes (issue JSBSim-Team#497).
bcoconni added a commit to bcoconni/jsbsim that referenced this issue Nov 6, 2021
@bcoconni
Copy link
Member

Bug fixed in release 1.1.9 and issuer @Mike402 is not responding to the question "Could you please check again to see if you did not miss the message "No GAIN specified (default: 1.0)" in the console ?".

Issue closed.

@ghost
Copy link
Author

ghost commented Nov 20, 2021

I am very sorry, this was lost in the dozens emails per day I have been receiving.

Yes, it prints the warning now, thank you.

@ghost
Copy link
Author

ghost commented Nov 20, 2021

There is still crash for the case "1." and no warnings for "3.", however. But it could be because 2020.3 has not received new version of JSBSim. Will check with Next.

@bcoconni
Copy link
Member

There is still crash for the case "1." and no warnings for "3.", however. But it could be because 2020.3 has not received new version of JSBSim.

Indeed.

@ghost
Copy link
Author

ghost commented Nov 20, 2021

Yes, still there on Next.

@bcoconni
Copy link
Member

Yes, still there on Next.

Just pushed the code on FlightGear next.
Let me know if that fixes the bug.

@ghost
Copy link
Author

ghost commented Nov 20, 2021

Yay, the number-of-input check works!

But with zero inputs it crashes after printing the check's error:

#0  0x0000555555f17e07 in FGFX::unbind() ()
#1  0x0000555556512b76 in std::_Function_handler<void (SGSubsystem*), SGSubsystemGroup::unbind()::{lambda(SGSubsystem*)#1}>::_M_invoke(std::_Any_data const&, SGSubsystem*&&) ()
#2  0x00005555565121d8 in SGSubsystemGroup::reverseForEach(std::function<void (SGSubsystem*)>) ()
#3  0x0000555556513cd3 in SGSubsystemGroup::unbind() ()
#4  0x000055555650fc65 in SGSubsystemMgr::unbind() ()
#5  0x00005555561494b3 in FGGlobals::~FGGlobals() ()
#6  0x0000555556149ed9 in FGGlobals::~FGGlobals() ()
#7  0x00005555561a29e5 in fgExitCleanup() ()
#8  0x00007ffff48f34a7 in __run_exit_handlers () from /usr/lib/libc.so.6
#9  0x00007ffff48f364e in exit () from /usr/lib/libc.so.6
#10 0x00007ffff48dbb2c in __libc_start_main () from /usr/lib/libc.so.6
#11 0x00005555558fafee in _start ()
#0  0x0000555555f17e07 in FGFX::unbind() ()
#1  0x0000555556512b76 in std::_Function_handler<void (SGSubsystem*), SGSubsystemGroup::unbind()::{lambda(SGSubsystem*)#1}>::_M_invoke(std::_Any_data const&, SGSubsystem*&&) ()
#2  0x00005555565121d8 in SGSubsystemGroup::reverseForEach(std::function<void (SGSubsystem*)>) ()
#3  0x0000555556513cd3 in SGSubsystemGroup::unbind() ()
#4  0x000055555650fc65 in SGSubsystemMgr::unbind() ()
#5  0x00005555561494b3 in FGGlobals::~FGGlobals() ()
#6  0x0000555556149ed9 in FGGlobals::~FGGlobals() ()
#7  0x00005555561a29e5 in fgExitCleanup() ()
#8  0x00007ffff48f34a7 in __run_exit_handlers () from /usr/lib/libc.so.6
#9  0x00007ffff48f364e in exit () from /usr/lib/libc.so.6
#10 0x00007ffff48dbb2c in __libc_start_main () from /usr/lib/libc.so.6
#11 0x00005555558fafee in _start ()

@ghost
Copy link
Author

ghost commented Nov 20, 2021

But it still does not seem to print a warning in case of 2 <gain>s.

@bcoconni
Copy link
Member

Yay, the number-of-input check works!

But with zero inputs it crashes after printing the check's error:

#0  0x0000555555f17e07 in FGFX::unbind() ()
#1  0x0000555556512b76 in std::_Function_handler<void (SGSubsystem*), SGSubsystemGroup::unbind()::{lambda(SGSubsystem*)#1}>::_M_invoke(std::_Any_data const&, SGSubsystem*&&) ()
#2  0x00005555565121d8 in SGSubsystemGroup::reverseForEach(std::function<void (SGSubsystem*)>) ()
#3  0x0000555556513cd3 in SGSubsystemGroup::unbind() ()
#4  0x000055555650fc65 in SGSubsystemMgr::unbind() ()
#5  0x00005555561494b3 in FGGlobals::~FGGlobals() ()
#6  0x0000555556149ed9 in FGGlobals::~FGGlobals() ()
#7  0x00005555561a29e5 in fgExitCleanup() ()
#8  0x00007ffff48f34a7 in __run_exit_handlers () from /usr/lib/libc.so.6
#9  0x00007ffff48f364e in exit () from /usr/lib/libc.so.6
#10 0x00007ffff48dbb2c in __libc_start_main () from /usr/lib/libc.so.6
#11 0x00005555558fafee in _start ()
#0  0x0000555555f17e07 in FGFX::unbind() ()
#1  0x0000555556512b76 in std::_Function_handler<void (SGSubsystem*), SGSubsystemGroup::unbind()::{lambda(SGSubsystem*)#1}>::_M_invoke(std::_Any_data const&, SGSubsystem*&&) ()
#2  0x00005555565121d8 in SGSubsystemGroup::reverseForEach(std::function<void (SGSubsystem*)>) ()
#3  0x0000555556513cd3 in SGSubsystemGroup::unbind() ()
#4  0x000055555650fc65 in SGSubsystemMgr::unbind() ()
#5  0x00005555561494b3 in FGGlobals::~FGGlobals() ()
#6  0x0000555556149ed9 in FGGlobals::~FGGlobals() ()
#7  0x00005555561a29e5 in fgExitCleanup() ()
#8  0x00007ffff48f34a7 in __run_exit_handlers () from /usr/lib/libc.so.6
#9  0x00007ffff48f364e in exit () from /usr/lib/libc.so.6
#10 0x00007ffff48dbb2c in __libc_start_main () from /usr/lib/libc.so.6
#11 0x00005555558fafee in _start ()

JSBSim just throws an exception when the number of inputs is not met and the crash you are reporting occurs within FlightGear code, not JSBSim code. So I'd suggest to first report this issue to the FlightGear devs and if they can trace back the issue to JSBSim then please report (or link) their conclusions here.

@bcoconni
Copy link
Member

But it still does not seem to print a warning in case of 2 <gain>s.

Regarding the case of the missing <input> elements, the code has been modified because you reported a crash and JSBSim must not crash when reading a malformed XML file. This has now been fixed and the opportunity has been taken to check extra <input>s in the process as this was merely a few lines of additional code. However validating the XML files (such as checking that there is a single <gain> element) is an entirely different story and it will not be done from the C++ code.

For the specific task of XML validation, there is an ongoing effort (issue #155) to update the XSD schemas for JSBSim: once updated, they could be used for XML validation, which is basically what you are requesting for the extra <gain> elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant