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

HPCC-13578 Prevent logging from destroyed crit secs from segfaulting #7336

Merged
merged 1 commit into from
Jun 10, 2015

Conversation

ghalliday
Copy link
Member

Signed-off-by: Gavin Halliday gavin.halliday@lexisnexis.com

@hpcc-jirabot
Copy link

@ghalliday
Copy link
Member Author

@richardkchapman please review. Note, setting the manger to NULL may have an effect - worth double checking.

@AttilaVamos
Copy link
Contributor

Automated Smoketest Build: success
HPCC Start: OK
HPCC Stop: OK

@@ -2244,6 +2244,7 @@ MODULE_EXIT()
delete thePassNoneFilter;
delete thePassLocalFilter;
delete thePassAllFilter;
theManager = NULL;
Copy link
Member

Choose a reason for hiding this comment

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

What about the other ones?

@richardkchapman
Copy link
Member

I can't see how setting it to NULL (rather than leaving it pointing to released memory) will make anything worse...

@ghalliday
Copy link
Member Author

No nor I, but I thought I better point it out.

@@ -288,7 +288,15 @@ class CriticalSection
inline ~CriticalSection()
{
#ifdef _ASSERT_LOCK_SUPPORT
assertex(owner==0 && depth==0);
Copy link
Member

Choose a reason for hiding this comment

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

This feels like it might be adding some overhead to a very commonly used bit of code...

Copy link
Member Author

Choose a reason for hiding this comment

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

On modern compilers try/catch should add no overhead to the code.
I could convert it to always use a fprintf instead, but potentially throwing an exception in a destructor isn't a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it should just be an assert?

Copy link
Member Author

Choose a reason for hiding this comment

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

assert would only be triggered in debug mode (that may or may not be a good thing).
I have only ever hit this when interrupting a program. I would probably go for a printf, but I'll implement any. You can choose.

@richardkchapman
Copy link
Member

@ghalliday one minor comment

@ghalliday
Copy link
Member Author

@richardkchapman which option do you prefer?

@richardkchapman
Copy link
Member

@ghalliday back to you

@richardkchapman
Copy link
Member

I choose assert. That way we get the checking in debug builds without any overhead on release ones (since this is very commonly executed code)

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
@ghalliday
Copy link
Member Author

@richardkchapman changed to assert, and cleared the other variables.

@AttilaVamos
Copy link
Contributor

Automated Smoketest Build: success
HPCC Start: OK
HPCC Stop: OK

#endif
}
Copy link
Member

Choose a reason for hiding this comment

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

Should there be an else fprintf(stderr...) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so - nothing will have come out in the stack report either.

A good solution would be for DBGLOG to fallback to fprintf if the logMsgManager was NULL, but that would require a condition on every DBGLOG. That might in itself be a good change.

richardkchapman added a commit that referenced this pull request Jun 10, 2015
HPCC-13578 Prevent logging from destroyed crit secs from segfaulting

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
@richardkchapman richardkchapman merged commit b1ef609 into hpcc-systems:candidate-5.4.0 Jun 10, 2015
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.

4 participants