-
Notifications
You must be signed in to change notification settings - Fork 271
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
Fix mbe play function segfault #130
Open
peads
wants to merge
14
commits into
szechyjs:master
Choose a base branch
from
peads:fix_mbe_play_fn_segfault
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks to N0YKG for the fix! I am just making the PR :)
…e currently read file, which was causing segfaults for large numbers of mbe files being read in. Extracted reader function calls to typedefed pointer, s.t. since the file type only needs to be read per file, it could be set to a generic function pointer thus cleaning up the read loop. Fixed end conditions for both the while and for loops, s.t. they break on exit flag, and their respective conditions. Removed redundant cleanup function call since the caller calls it on return of the play function anyway.
…extensible beyond EOF being defined as -1 in glibc. Changed expected EOF in playMbeFile to be handled specially (i.e. not sent to error handler) because it's more likely than not to be expected, and in any case, we can just trying playing the next file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In lieu of creating an issue and assigning it to myself, I'm just gonna describe the problem here:
I like to play a lot of mbe files that have accumulated over time, say overnight. Occasionally, the replay would just segfault and die. Upon investigation I found that the
dsd_mbe::playMbeFiles
was not closing the file upon completion of the read loop (I found specifically when I added a call toperror
that it was getting "Too many open files"); it also wasn't testing generally for errors while reading nor was it handling EOF detection correctly (i.e. usingfeof
incorrectly: https://stackoverflow.com/a/36165087). Digging deeper, I found that there was a general lack of error checking indsd_file::openMbeInFile
(which the aforementioned function calls). So, I added some there as well.