Skip to content

[SYCL] Fix unsafe usage of raw pointer to command in addHostAccessor #5789

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

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

KseniyaTikhomirova
Copy link
Contributor

Command may be destroyed by cleanup process in another thread

Signed-off-by: Tikhomirova, Kseniya [email protected]

Command may be destroyed by cleanup process in another thread

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
@KseniyaTikhomirova KseniyaTikhomirova requested a review from a team as a code owner March 11, 2022 13:51
@bader
Copy link
Contributor

bader commented Mar 11, 2022

@alexbatashev, how is it possible to have "build" directory in the image?

CMake configuration
  mkdir: cannot create directory 'build': File exists
  Error: Process completed with exit code 1.

https://github.com/intel/llvm/runs/5512042627?check_suite_focus=true

}

if (!NewCmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this premature exit the original problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, original problem was that addHostAccessor (update requirement cmd and empty command creation) - the code under write lock here may be called by multiple threads (cmd1 for thread1 and command2 for thread2) and cmd1 may be removed from leaves and deleted under lock for cmd2 while code under read lock here that uses this raw pointer to cmd1 is not executed yet (enqueue is done but in in releaseHostAccessor in another thread that enqueue unblocked commands). In this case here we have not null but not valid pointer. So we receive - seg fault (rarely) or hang (frequently) because that memory block is reused for new cmd3 and is dependent on empty cmd for cmd1 that leads to closed dependency.

Copy link
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

LGTM

@alexbatashev
Copy link
Contributor

@alexbatashev, how is it possible to have "build" directory in the image?

CMake configuration
  mkdir: cannot create directory 'build': File exists
  Error: Process completed with exit code 1.

https://github.com/intel/llvm/runs/5512042627?check_suite_focus=true

The previous job that ran on this runner was terminated abnormally. Restart will help.

@bader bader merged commit 62ca43a into intel:sycl Mar 14, 2022
@bader
Copy link
Contributor

bader commented Mar 14, 2022

@alexbatashev, how is it possible to have "build" directory in the image?

CMake configuration
  mkdir: cannot create directory 'build': File exists
  Error: Process completed with exit code 1.

https://github.com/intel/llvm/runs/5512042627?check_suite_focus=true

The previous job that ran on this runner was terminated abnormally. Restart will help.

I think we should handle this situation w/o restart.

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