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

Crashes with "ctc debug" commands #536

Closed
racingmars opened this issue Dec 29, 2022 · 5 comments
Closed

Crashes with "ctc debug" commands #536

racingmars opened this issue Dec 29, 2022 · 5 comments
Assignees
Labels
BUG The issue describes likely incorrect product functionality that likely needs corrected.

Comments

@racingmars
Copy link

Hercules version: 4.5.0.10830-SDL-g58578601
Host OS: Arch Linux x86_64. Linux kernel version 6.1.1-arch1-1

When I use Hercules console commands such as ctc debug on 502 and ctc debug off 502, things work as expected. However, if I enter partial commands such as ctc debug or ctc debug off, Hercules crashes with:

    +++ OOPS! +++

Hercules has crashed! (Segmentation fault)

This also happens with what I believe to be a complete valid command, ctc debug on all.

This is reproducible with the following minimal hercules.cnf file:

0502 CTCE 15620 127.0.0.1 15600

Expected behavior: if the command supplied is incomplete or requires more arguments, I would expect an error message, not a crash. Furthermore, the help ctc text suggests to me that ctc debug on and ctc debug off (without optional device number or ALL keyword) should be valid.

@Fish-Git Fish-Git added BUG The issue describes likely incorrect product functionality that likely needs corrected. IN PROGRESS... I'm working on it! (Or someone else is!) labels Dec 29, 2022
@Fish-Git Fish-Git self-assigned this Dec 29, 2022
@Fish-Git
Copy link
Member

Hi Matthew!

I was able to reproduce the crash and am working on a fix right now. Thank you for reporting this.

While I have not completed my analysis yet, I believe the bug is being caused by the fact that the device in question has not established a connection to the other system yet, and thus has not fully initialized yet. (Some internal device fields are still NULL.) I suspect if you try the same thing after the device has finished initializing (i.e. has finished connecting to the other system) the crash would probably not occur. But I will try to confirm that.

In any case, the problem is being actively looked into and a fix for it will be forthcoming.

Fish-Git added a commit that referenced this issue Dec 29, 2022
Closes #536.

Note: also added support for "ctc debug" command by itself (i.e. without any other operands) to LIST the current CTC debugging state for all CTC devices.
@Fish-Git
Copy link
Member

Fixed by commit 0afad3b.

Closing.

NOTE:  As it turns out, the crash was not caused by the CTCE device not being connected. It would have also crashed even if it was already connected. The bug was actually caused by some missing code for CTCE devices in the ctc debug command itself, causing it to be erroneously handled / processed / treated as a PTP device instead of a CTCE device.  (Oops!)

@Fish-Git
Copy link
Member

Fish-Git commented Dec 29, 2022

P.S. To get the fix you will of course need to do a git pull and then rebuild the develop branch of Hercules. Otherwise you'll just have to wait until the next release.

@Fish-Git
Copy link
Member

Fish-Git commented Dec 29, 2022

P.S. #2:  I also added support for entering the ctc debug command by itself (i.e. without any other operands) to list the current CTC debugging state for all CTC devices.

@racingmars
Copy link
Author

Thanks Fish! I've pulled the develop branch and ctc debug ... is behaving perfectly now.

@Fish-Git Fish-Git removed the IN PROGRESS... I'm working on it! (Or someone else is!) label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG The issue describes likely incorrect product functionality that likely needs corrected.
Projects
None yet
Development

No branches or pull requests

2 participants