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-23183 Thread local hook fix when on main thread #13197

Conversation

jakesmith
Copy link
Member

@jakesmith jakesmith commented Dec 3, 2019

Track hooks installed on main thread separately, in a non
thread locl vector.

Signed-off-by: Jake Smith jake.smith@lexisnexisrisk.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@hpcc-jirabot
Copy link

@jakesmith
Copy link
Member Author

@richardkchapman - please review.

@jakesmith jakesmith force-pushed the hpcc-23183-threadlocal-hook-fix branch from b6c75d3 to 06737ec Compare December 3, 2019 14:47
@jakesmith
Copy link
Member Author

@richardkchapman - modified so that callThreadTerminationHooks handles the condition based on main thread id.

{
tid = GetCurrentThreadId();
}
} mainThreadIdHelper;
Copy link
Member

Choose a reason for hiding this comment

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

should be static?

Copy link
Member Author

Choose a reason for hiding this comment

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

agree, have changed.

@richardkchapman
Copy link
Member

One minor comment. Also would be worth adding a comment about why this is necessary (i.e. that thread-local objects are destroyed before functions called via atexit )

@ghalliday can you sanity check too

Track hooks installed on main thread separately, in a non
thread locl vector.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
@jakesmith jakesmith force-pushed the hpcc-23183-threadlocal-hook-fix branch from 06737ec to 7897e37 Compare December 4, 2019 11:07
@jakesmith
Copy link
Member Author

made mainThreadIdHelper static and added a comment.

@ghalliday - please review.

@HPCCSmoketest
Copy link
Contributor

Automated Smoketest: ✅
OS: centos 7.6.1810 (Linux 3.10.0-327.28.3.el7.x86_64)
GCC:gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Sha: 7897e37
Build: success
Build: success
Install HPCC Platform
HPCC Start: OK

Unit tests result:

Test total passed failed errors timeout elaps
unittest 116 116 0 0 0 35 sec
wutoolTest(Dali) 19 19 0 0 0 3 sec
wutoolTest(Cassandra) 19 19 0 0 0 7 sec

Regression test result:

phase total pass fail elaps
setup (hthor) 11 11 0 27 sec (00:00:27)
setup (thor) 11 11 0 47 sec (00:00:47)
setup (roxie) 11 11 0 26 sec (00:00:26)
test (hthor) 866 866 0 188 sec (00:03:08)
test (thor) 801 801 0 732 sec (00:12:12)
test (roxie) 943 943 0 233 sec (00:03:53)

HPCC Stop: OK
Time stats:

Prep time Build time Package time Install time Start time Test time Stop time Summary
30 sec (00:00:30) 259 sec (00:04:19) 0 sec (00:00:00) 3 sec (00:00:03) 20 sec (00:00:20) 1499 sec (00:24:59) 20 sec (00:00:20) 1831 sec (00:30:31)

@@ -41,26 +41,45 @@

//static __thread ThreadTermFunc threadTerminationHook;
Copy link
Member

Choose a reason for hiding this comment

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

This line should have been removed by my previous PR in tis area..

@ghalliday ghalliday merged commit 28aaf9c into hpcc-systems:candidate-7.6.x Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants