Skip to content

Commit aca879b

Browse files
sherry-yuanpcolberg
authored andcommitted
Fix TSAN data races
------------------------------------------------------ As found in #71, tsan reported several issues in the acl_test Currently when release command queue are called (which frees the memory) subsequent still checks the values at the same address which cause tsan to report heap-use-after-free.
1 parent 38bd75e commit aca879b

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

test/acl_command_queue_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ MT_TEST(acl_command_queue, create_with_properties) {
387387
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
388388
CHECK_EQUAL(1, acl_ref_count(cq));
389389
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
390-
CHECK_EQUAL(0, acl_ref_count(cq));
391-
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq)));
392390

393391
// wait until all threads do their checks on the 0-ref-count command
394392
// queue before starting the next iteration of the loop and creating new
@@ -421,8 +419,6 @@ MT_TEST(acl_command_queue, create_with_properties) {
421419
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
422420
CHECK_EQUAL(1, acl_ref_count(cq));
423421
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
424-
CHECK_EQUAL(0, acl_ref_count(cq));
425-
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq)));
426422

427423
// wait until all threads do their checks on the 0-ref-count command
428424
// queue before starting the next iteration of the loop and creating new
@@ -674,15 +670,6 @@ MT_TEST(acl_command_queue, after_context_release) {
674670
// Should be able to release all the way.
675671
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq0));
676672
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq1));
677-
CHECK_EQUAL(0, acl_ref_count(cq0));
678-
CHECK_EQUAL(0, acl_ref_count(cq1));
679-
680-
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq0)));
681-
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq1)));
682-
683-
// And once it's gone, it's gone.
684-
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, clReleaseCommandQueue(cq0));
685-
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, clReleaseCommandQueue(cq1));
686673
}
687674

688675
// Main Event is in an OOO queue. It has a dependent event in an in-order queue.

0 commit comments

Comments
 (0)